apollo-client-mock
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"name": "apollo-client-mock", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Easily mock the Apollo client for your integration tests", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -70,16 +70,10 @@ # Apollo Client Mock | ||
test('should call resolver without blowing up', () => { | ||
const overwriteResolvers = { | ||
const getDomainState = jest.fn() | ||
const resolverOverwrites = { | ||
Mutation: () => ({ | ||
getDomainState: (_, { name }, context) => { | ||
return { | ||
name, | ||
state: 'Closed' | ||
} | ||
} | ||
getDomainState | ||
}) | ||
} | ||
render( | ||
<ApolloProvider client={createClient(overwriteResolvers)}> | ||
const { getByText, container } = renderIntoDocument( | ||
<ApolloProvider client={createClient(resolverOverwrites)}> | ||
<CheckAvailabilityContainer /> | ||
@@ -89,4 +83,12 @@ </ApolloProvider> | ||
//the rest of your test | ||
} | ||
const submitButton = getByText('Check Availability') | ||
const form = container.querySelector('form') | ||
const input = form.querySelector('input') | ||
input.value = 'vitalik.eth' | ||
Simulate.change(input) | ||
submitButton.click() | ||
expect(getDomainState).toHaveBeenCalledTimes(1) | ||
}) | ||
``` | ||
This is useful if you want to setup a spy for your resolve function and you want to ensure it has been called |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5060
93