Skip to content

Instantly share code, notes, and snippets.

@devxoul
Last active February 23, 2021 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devxoul/5e56869af10146786ff9f6d97dc3b99e to your computer and use it in GitHub Desktop.
Save devxoul/5e56869af10146786ff9f6d97dc3b99e to your computer and use it in GitHub Desktop.
Use expect matcher in Apollo MockedProvider variables
jest.mock('@wry/equality', () => ({
equal: (lhs: any, rhs: any) => {
const equals = require('expect/build/jasmineUtils').equals(lhs, rhs)
return equals || jest.requireActual('@wry/equality').equal(lhs, rhs)
}
}))
const mocks = [
{
request: {
query: MY_MUTATION,
variables: expect.anything()
}
}
]
<MockProvider mocks={mocks}>
</MockProvider>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment