You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I then cannot test my component as it will always return false
In my specific case, I've also loaded initialize() from @googlemaps/jest-mocks in order to fix the other Uncaught [TypeError: Cannot read properties of undefined (reading 'maps')] error that presents itself when trying to hit any google.maps type vars:
// Mocking useJsApiLoader to pretend google maps is loaded
jest.mock('@react-google-maps/api', () => {
return {
useJsApiLoader: () => ({ isLoaded: true }),
};
});
beforeEach(() => {
initialize();
});
However, this causes the following error when I try to run my tests: Uncaught 'Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s'
Any thoughts? Basically anytime it tries to render the component, I get this error.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is an extension of a follow-up question that was asked in #3047 (reply in thread). In particular, asked:
What if I have something like the following:
I then cannot test my component as it will always return false
In my specific case, I've also loaded
initialize()
from @googlemaps/jest-mocks in order to fix the otherUncaught [TypeError: Cannot read properties of undefined (reading 'maps')]
error that presents itself when trying to hit anygoogle.maps
type vars:However, this causes the following error when I try to run my tests:
Uncaught 'Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s'
Any thoughts? Basically anytime it tries to render the component, I get this error.
Beta Was this translation helpful? Give feedback.
All reactions