@shopify/graphql-testing
Advanced tools
Comparing version 0.0.0-snapshot-20220830190822 to 0.0.0-snapshot-20220907212019
@@ -13,3 +13,2 @@ 'use strict'; | ||
constructor(mock, { | ||
possibleTypes = {}, | ||
cacheOptions = {}, | ||
@@ -33,6 +32,3 @@ links = [] | ||
const cache = new client.InMemoryCache({ | ||
possibleTypes, | ||
...cacheOptions | ||
}); | ||
const cache = new client.InMemoryCache(cacheOptions); | ||
this.mockLink = new mocks.MockLink(mock || defaultGraphQLMock); | ||
@@ -39,0 +35,0 @@ const link = client.ApolloLink.from([...links, new inflight.InflightLink({ |
import { GraphQL, Options } from './graphql-controller'; | ||
import { GraphQLMock } from './types'; | ||
export declare function createGraphQLFactory(options?: Options): (mock?: GraphQLMock | undefined) => GraphQL; | ||
export declare function createGraphQLFactory(options?: Options): (mock?: GraphQLMock) => GraphQL; | ||
//# sourceMappingURL=factory.d.ts.map |
@@ -1,7 +0,6 @@ | ||
import { ApolloClient, ApolloLink, ApolloReducerConfig, PossibleTypesMap } from '@apollo/client'; | ||
import { ApolloClient, ApolloLink, InMemoryCacheConfig } from '@apollo/client'; | ||
import { Operations } from './operations'; | ||
import { GraphQLMock, FindOptions } from './types'; | ||
export interface Options { | ||
possibleTypes?: PossibleTypesMap; | ||
cacheOptions?: ApolloReducerConfig; | ||
cacheOptions?: InMemoryCacheConfig; | ||
links?: ApolloLink[]; | ||
@@ -18,3 +17,3 @@ } | ||
private readonly mockLink; | ||
constructor(mock: GraphQLMock | undefined, { possibleTypes, cacheOptions, links }?: Options); | ||
constructor(mock: GraphQLMock | undefined, { cacheOptions, links }?: Options); | ||
update(mock: GraphQLMock): void; | ||
@@ -21,0 +20,0 @@ resolveAll(options?: FindOptions): Promise<void>; |
{ | ||
"name": "@shopify/graphql-testing", | ||
"version": "0.0.0-snapshot-20220830190822", | ||
"version": "0.0.0-snapshot-20220907212019", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Utilities to create mock GraphQL factories", |
@@ -20,7 +20,9 @@ # `@shopify/graphql-testing` | ||
The default utility exported by this library is `createGraphQLFactory`. This factory accepts an optional options argument that allows you to pass a `unionOrIntersectionTypes` array and/ or additional `cacheOptions` that will be used to construct an Apollo in-memory cache and/ or `links` which can contain `ApolloLink`s that will be passed to the apollo client links. | ||
The default utility exported by this library is `createGraphQLFactory`. This factory accepts an optional options argument that allows you to pass a `cacheOptions` that will be used to construct an Apollo in-memory cache and/ or `links` which can contain `ApolloLink`s that will be passed to the apollo client links. | ||
```js | ||
const createGraphQL = createGraphQLFactory({ | ||
unionOrIntersectionTypes: [], | ||
cacheOptions: { | ||
possibleTypes: {}, | ||
}, | ||
}); | ||
@@ -27,0 +29,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
185
56842
790