@shopify/graphql-testing
Advanced tools
Comparing version 4.1.2 to 4.2.0
@@ -10,2 +10,8 @@ # Changelog | ||
## [4.2.0] - 2020-06-24 | ||
### Changed | ||
- Add subsequential request mocking support ([#1534](https://github.com/Shopify/quilt/pull/1534)) | ||
## [4.1.0] - 2020-04-20 | ||
@@ -12,0 +18,0 @@ |
@@ -17,3 +17,5 @@ import { ApolloReducerConfig } from 'apollo-cache-inmemory'; | ||
private readonly wrappers; | ||
private readonly mockLink; | ||
constructor(mock: GraphQLMock | undefined, { unionOrIntersectionTypes, cacheOptions }?: Options); | ||
update(mock: GraphQLMock): void; | ||
resolveAll(options?: FindOptions): Promise<void>; | ||
@@ -20,0 +22,0 @@ wrap(wrapper: Wrapper): void; |
@@ -17,2 +17,3 @@ "use strict"; | ||
this.wrappers = []; | ||
this.mockLink = null; | ||
this.handleCreate = function (request) { | ||
@@ -32,2 +33,3 @@ _this.pendingRequests.add(request); | ||
}) }, cacheOptions)); | ||
this.mockLink = new links_1.MockLink(mock || defaultGraphQLMock); | ||
var link = apollo_link_1.ApolloLink.from([ | ||
@@ -38,3 +40,3 @@ new links_1.InflightLink({ | ||
}), | ||
new links_1.MockLink(mock || defaultGraphQLMock), | ||
this.mockLink, | ||
]); | ||
@@ -46,2 +48,8 @@ this.client = new client_1.TestingApolloClient({ | ||
} | ||
GraphQL.prototype.update = function (mock) { | ||
if (!this.mockLink) { | ||
return; | ||
} | ||
this.mockLink.updateMock(mock); | ||
}; | ||
GraphQL.prototype.resolveAll = function (options) { | ||
@@ -48,0 +56,0 @@ if (options === void 0) { options = {}; } |
@@ -6,4 +6,5 @@ import { ApolloLink, Observable, Operation } from 'apollo-link'; | ||
constructor(mock: GraphQLMock); | ||
updateMock(mock: GraphQLMock): void; | ||
request(operation: Operation): Observable<any>; | ||
} | ||
//# sourceMappingURL=mocks.d.ts.map |
@@ -13,2 +13,5 @@ "use strict"; | ||
} | ||
MockLink.prototype.updateMock = function (mock) { | ||
this.mock = mock; | ||
}; | ||
MockLink.prototype.request = function (operation) { | ||
@@ -15,0 +18,0 @@ var _this = this; |
{ | ||
"name": "@shopify/graphql-testing", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Utilities to create mock GraphQL factories", |
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
45125
689