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

Fix newData raising error per #3455 issue #3539

Merged
merged 2 commits into from
Oct 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/testing/src/mocks/mockLink.ts
Original file line number Diff line number Diff line change
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