graphql-mock
Advanced tools
Comparing version 0.2.1 to 0.3.0
import { ApolloClient } from 'apollo-client'; | ||
import { NormalizedCacheObject } from 'apollo-cache-inmemory'; | ||
import Expectations from './expect'; | ||
@@ -11,6 +10,6 @@ import { GraphQLSchema } from 'graphql'; | ||
export default class GraphQLMock { | ||
client: ApolloClient<NormalizedCacheObject>; | ||
client: ApolloClient<any>; | ||
requests: GQLRequest[]; | ||
expectations: Expectations; | ||
constructor(schema: string | GraphQLSchema, mocks?: object, resolvers?: any); | ||
constructor(schema: string | GraphQLSchema | ApolloClient<any>, mocks?: object, resolvers?: any); | ||
reset(): void; | ||
@@ -17,0 +16,0 @@ readonly queries: string[]; |
@@ -15,2 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const apollo_client_1 = require("apollo-client"); | ||
const client_1 = require("./client"); | ||
@@ -24,3 +25,3 @@ const expect_1 = require("./expect"); | ||
this.expectations = new expect_1.default(); | ||
this.client = client_1.default(schema, mocks, resolvers); | ||
this.client = schema instanceof apollo_client_1.ApolloClient ? schema : client_1.default(schema, mocks, resolvers); | ||
this.patchClient(); | ||
@@ -27,0 +28,0 @@ } |
{ | ||
"name": "graphql-mock", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "GraphQL endpoint mockery library for testing", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -113,2 +113,14 @@ # GraphQL Client Side Mocking | ||
## Using Existing ApolloClient | ||
If you have your own flavour configured ApolloClient already setup and ready to go, | ||
you can use it instead of a schema: | ||
``` | ||
const mock = new GraphqlMock(myOwnClient); | ||
``` | ||
__NOTE__: this is not going to work with url linked clients | ||
## API & Stuff | ||
@@ -115,0 +127,0 @@ |
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
12053
156