Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Fix newData raising error per #3455 issue (#3539)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Kłeczek authored and hwillson committed Oct 1, 2019
1 parent d67d00c commit 1658435
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/testing/src/mocks/mockLink.ts
Expand Up @@ -87,13 +87,15 @@ export class MockLink extends ApolloLink {

this.mockedResponsesByKey[key].splice(responseIndex, 1);

const { result, error, delay, newData } = response;
const { newData } = response;

if (newData) {
response.result = newData();
this.mockedResponsesByKey[key].push(response);
}

const { result, error, delay } = response;

if (!result && !error) {
throw new Error(
`Mocked response should contain either result or error: ${key}`
Expand Down

0 comments on commit 1658435

Please sign in to comment.