We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm following the example to extending mocks in an attempt to change the implementation of Map.getBounds to return a new value.
Map.getBounds
I reassign the google.maps.Map global as described using the following:
google.maps.Map
beforeEach(() => { initialize(); google.maps.Map = class extends google.maps.Map { getBounds(...args: Parameters<InstanceType<typeof google.maps.Map>["getBounds"]>): ReturnType<InstanceType<typeof google.maps.Map>["getBounds"]> { // Call a mock, etc.. return new google.maps.LatLngBounds({ lat: 50, lng: 50 }); } }; });
Yet my getBounds method is never called. Constructors are called as expected if I override them, but not other methods. Am I doing something wrong?
getBounds
Additionally, when I override in this fashion, the instance is no longer available when using mockInstances.get(Map). Is that expected?
mockInstances.get(Map)
FWIW, I'm using Vitest, not Jest. But as I understand it the API is synonymous so shouldn't make a difference here.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm following the example to extending mocks in an attempt to change the implementation of
Map.getBounds
to return a new value.I reassign the
google.maps.Map
global as described using the following:Yet my
getBounds
method is never called. Constructors are called as expected if I override them, but not other methods. Am I doing something wrong?Additionally, when I override in this fashion, the instance is no longer available when using
mockInstances.get(Map)
. Is that expected?FWIW, I'm using Vitest, not Jest. But as I understand it the API is synonymous so shouldn't make a difference here.
The text was updated successfully, but these errors were encountered: