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
The thing is, always have Status of loading, and it never goes to Success, so the child component is never rendered. Is there a way to mock that Status to Success?
It's a bit tricky since the google maps API will typically not be available in your tests. For that, but you can use googlemaps/js-jest-mocks to some extent. As for the status, you'd need to mock the @googlemaps/js-api-loader package and configure the Loader.load() method to always return a resolved promise, see here how the loader is used:
Activity
wangela commentedon Apr 21, 2023
If you would like to upvote the priority of this issue, please comment below or react with 👍 so we can see what is popular when we triage.
@testrobpoc Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:
google-mapstagThis is an automated message, feel free to ignore.
angelod1as commentedon May 12, 2023
+1
usefulthink commentedon Oct 12, 2023
It's a bit tricky since the google maps API will typically not be available in your tests. For that, but you can use googlemaps/js-jest-mocks to some extent. As for the status, you'd need to mock the
@googlemaps/js-api-loaderpackage and configure theLoader.load()method to always return a resolved promise, see here how the loader is used:react-wrapper/src/index.tsx
Lines 74 to 86 in 5bf3929
localjo commentedon Feb 6, 2024
For anyone else who is looking for a solution, here is what worked for me:
@googlemaps/jest-mocksin devDependenciesimport { initialize } from "@googlemaps/jest-mocks";to the top.describeblock, add the following:Wrapper.name === 'MockWrapper'. For example:Hopefully that helps someone.
angelod1as commentedon Feb 6, 2024
@localjo 's answer should be in docs.