Skip to content

Commit

Permalink
Improve QueryStore.initQuery network status setting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hwillson committed May 25, 2018
1 parent fb57949 commit a5d76ac
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/apollo-client/src/data/__tests__/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ describe('QueryStore', () => {
);
},
);

it(
'should not attempt to set the network status of a ' +
'`fetchMoreForQueryId` query, if it does not exist in the store',
() => {
queryStore.stopQuery(queryId);
expect(() => {
queryStore.initQuery({
queryId: 'new-query-id',
document: {} as DocumentNode,
storePreviousVariables: false,
variables: {},
isPoll: false,
isRefetch: false,
metadata: {},
fetchMoreForQueryId: queryId,
});
}).not.toThrow("Cannot set property 'networkStatus' of undefined");
},
);
});

describe('markQueryResult', () => {
Expand Down

0 comments on commit a5d76ac

Please sign in to comment.