@shopify/graphql-testing
Advanced tools
Comparing version 0.0.0-snapshot-20220706153926 to 0.0.0-snapshot-20220728131612
@@ -5,3 +5,5 @@ 'use strict'; | ||
var client = require('@apollo/client'); | ||
var apolloLink = require('apollo-link'); | ||
var apolloCacheInmemory = require('apollo-cache-inmemory'); | ||
var client = require('./client.js'); | ||
var operations = require('./operations.js'); | ||
@@ -14,3 +16,3 @@ var utilities = require('./utilities.js'); | ||
constructor(mock, { | ||
possibleTypes = {}, | ||
unionOrIntersectionTypes = [], | ||
cacheOptions = {}, | ||
@@ -34,12 +36,18 @@ links = [] | ||
const cache = new client.InMemoryCache({ | ||
possibleTypes, | ||
const cache = new apolloCacheInmemory.InMemoryCache({ | ||
fragmentMatcher: new apolloCacheInmemory.IntrospectionFragmentMatcher({ | ||
introspectionQueryResultData: { | ||
__schema: { | ||
types: unionOrIntersectionTypes | ||
} | ||
} | ||
}), | ||
...cacheOptions | ||
}); | ||
this.mockLink = new mocks.MockLink(mock || defaultGraphQLMock); | ||
const link = client.ApolloLink.from([...links, new inflight.InflightLink({ | ||
const link = apolloLink.ApolloLink.from([...links, new inflight.InflightLink({ | ||
onCreated: this.handleCreate, | ||
onResolved: this.handleResolve | ||
}), this.mockLink]); | ||
this.client = new client.ApolloClient({ | ||
this.client = new client.TestingApolloClient({ | ||
link, | ||
@@ -46,0 +54,0 @@ cache |
@@ -5,5 +5,5 @@ 'use strict'; | ||
var client = require('@apollo/client'); | ||
var apolloLink = require('apollo-link'); | ||
class InflightLink extends client.ApolloLink { | ||
class InflightLink extends apolloLink.ApolloLink { | ||
constructor(options) { | ||
@@ -32,3 +32,3 @@ super(); | ||
this.options.onCreated(request); | ||
return new client.Observable(observer => { | ||
return new apolloLink.Observable(observer => { | ||
return nextLink(operation).subscribe({ | ||
@@ -35,0 +35,0 @@ complete() { |
@@ -5,6 +5,6 @@ 'use strict'; | ||
var client = require('@apollo/client'); | ||
var apolloLink = require('apollo-link'); | ||
var graphql = require('graphql'); | ||
class MockLink extends client.ApolloLink { | ||
class MockLink extends apolloLink.ApolloLink { | ||
constructor(mock) { | ||
@@ -20,3 +20,3 @@ super(); | ||
request(operation) { | ||
return new client.Observable(obs => { | ||
return new apolloLink.Observable(obs => { | ||
const { | ||
@@ -23,0 +23,0 @@ mock |
@@ -1,6 +0,8 @@ | ||
import { ApolloClient, ApolloLink, ApolloReducerConfig, PossibleTypesMap } from '@apollo/client'; | ||
import { ApolloLink } from 'apollo-link'; | ||
import { ApolloReducerConfig } from 'apollo-cache-inmemory'; | ||
import { ApolloClient } from 'apollo-client'; | ||
import { Operations } from './operations'; | ||
import { GraphQLMock, FindOptions } from './types'; | ||
export interface Options { | ||
possibleTypes?: PossibleTypesMap; | ||
unionOrIntersectionTypes?: any[]; | ||
cacheOptions?: ApolloReducerConfig; | ||
@@ -18,3 +20,3 @@ links?: ApolloLink[]; | ||
private readonly mockLink; | ||
constructor(mock: GraphQLMock | undefined, { possibleTypes, cacheOptions, links }?: Options); | ||
constructor(mock: GraphQLMock | undefined, { unionOrIntersectionTypes, cacheOptions, links, }?: Options); | ||
update(mock: GraphQLMock): void; | ||
@@ -21,0 +23,0 @@ resolveAll(options?: FindOptions): Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import { ApolloLink, Observable, Operation, NextLink, FetchResult } from '@apollo/client'; | ||
import { ApolloLink, Observable, Operation, NextLink, FetchResult } from 'apollo-link'; | ||
import { MockRequest } from '../types'; | ||
@@ -3,0 +3,0 @@ interface Options { |
@@ -1,2 +0,2 @@ | ||
import { ApolloLink, Observable, Operation } from '@apollo/client'; | ||
import { ApolloLink, Observable, Operation } from 'apollo-link'; | ||
import { GraphQLMock } from '../types'; | ||
@@ -3,0 +3,0 @@ export declare class MockLink extends ApolloLink { |
@@ -1,2 +0,2 @@ | ||
import { Operation } from '@apollo/client'; | ||
import { Operation } from 'apollo-link'; | ||
export declare function assertIsGraphQL(graphQL: unknown, { expectation, isNot }: { | ||
@@ -3,0 +3,0 @@ expectation: string; |
@@ -1,2 +0,2 @@ | ||
import { Operation } from '@apollo/client'; | ||
import { Operation } from 'apollo-link'; | ||
import { FindOptions } from './types'; | ||
@@ -3,0 +3,0 @@ export declare class Operations { |
import { DocumentNode } from 'graphql'; | ||
import { GraphQLRequest, Operation } from '@apollo/client'; | ||
import { GraphQLRequest, Operation } from 'apollo-link'; | ||
export interface FindOptions { | ||
@@ -4,0 +4,0 @@ query?: DocumentNode | { |
{ | ||
"name": "@shopify/graphql-testing", | ||
"version": "0.0.0-snapshot-20220706153926", | ||
"version": "0.0.0-snapshot-20220728131612", | ||
"license": "MIT", | ||
@@ -34,3 +34,5 @@ "description": "Utilities to create mock GraphQL factories", | ||
"dependencies": { | ||
"@apollo/client": "^3.5.8", | ||
"apollo-cache-inmemory": ">=1.0.0 <2.0.0", | ||
"apollo-client": ">=2.0.0 <3.0.0", | ||
"apollo-link": ">=1.0.0 <2.0.0", | ||
"graphql": ">=14.5.0 <16.0.0", | ||
@@ -40,3 +42,3 @@ "jest-matcher-utils": "^26.6.2" | ||
"devDependencies": { | ||
"graphql-typed": "^3.0.0-a3-beta.1" | ||
"graphql-typed": "^2.0.0" | ||
}, | ||
@@ -43,0 +45,0 @@ "files": [ |
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
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
63426
67
881
5
+ Addedapollo-client@>=2.0.0 <3.0.0
+ Addedapollo-link@>=1.0.0 <2.0.0
+ Added@types/zen-observable@0.8.7(transitive)
+ Added@wry/context@0.4.4(transitive)
+ Added@wry/equality@0.1.11(transitive)
+ Addedapollo-cache@1.3.5(transitive)
+ Addedapollo-cache-inmemory@1.6.6(transitive)
+ Addedapollo-client@2.6.10(transitive)
+ Addedapollo-link@1.2.14(transitive)
+ Addedapollo-utilities@1.3.4(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedoptimism@0.10.3(transitive)
+ Addedsymbol-observable@1.2.0(transitive)
+ Addedts-invariant@0.4.4(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedzen-observable-ts@0.8.21(transitive)
- Removed@apollo/client@^3.5.8
- Removed@apollo/client@3.12.3(transitive)
- Removed@graphql-typed-document-node/core@3.2.0(transitive)
- Removed@wry/caches@1.0.1(transitive)
- Removed@wry/context@0.7.4(transitive)
- Removed@wry/equality@0.5.7(transitive)
- Removed@wry/trie@0.5.0(transitive)
- Removedgraphql-tag@2.12.6(transitive)
- Removedhoist-non-react-statics@3.3.2(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedoptimism@0.18.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedrehackt@0.1.0(transitive)
- Removedresponse-iterator@0.2.6(transitive)
- Removedsymbol-observable@4.0.0(transitive)
- Removedts-invariant@0.10.3(transitive)
- Removedtslib@2.8.1(transitive)
- Removedzen-observable-ts@1.2.5(transitive)