Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-client-mock

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-client-mock - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

package.json
{
"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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc