apollo-test-utils
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "apollo-test-utils", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "", | ||
"author": "Kamil Kisiela <kamil.kisiela@gmail.com>", | ||
"contributors": ["Jonas Helfer <jonas@helfer.email>"], | ||
"contributors": [ | ||
"Jonas Helfer <jonas@helfer.email>" | ||
], | ||
"license": "MIT", | ||
@@ -8,0 +10,0 @@ "main": "./dist/src/index.js", |
# apollo-test-utils | ||
This is a very rudimentary package that currently only exports functions for mocking an Apollo Client network interface. Here's an example for how to use it: | ||
```js | ||
import ApolloClient from 'apollo-client'; | ||
import gql from 'graphql-tag'; | ||
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools'; | ||
import { mockNetworkInterfaceWithSchema } from 'apollo-test-utils'; | ||
const typeDefs = ` | ||
type User { | ||
id: Int | ||
name: String | ||
} | ||
type Query { | ||
user: User | ||
} | ||
`; | ||
const schema = makeExecutableSchema({ typeDefs }); | ||
addMockFunctionsToSchema({ schema }); | ||
const mockNetworkInterface = mockNetworkInterfaceWithSchema({ schema }); | ||
const client = new ApolloClient({ | ||
networkInterface: mockNetworkInterface, | ||
}); | ||
client.query({ | ||
query: gql`{ user { name } }`, | ||
}); | ||
``` |
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
20916
36