Skip to content

Commit

Permalink
Add test to prevent regression
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 17, 2020
1 parent 3ee819a commit a04a57c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions exchanges/graphcache/src/store/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,21 @@ describe('commutative changes', () => {
InMemoryData.initDataState(data, null);
expect(InMemoryData.readRecord('Query', 'index')).toBe(2);
});

it('prevents inspectFields from failing for uninitialised layers', () => {
InMemoryData.initDataState(data, null);
InMemoryData.writeRecord('Query', 'test', true);
InMemoryData.clearDataState();

InMemoryData.reserveLayer(data, 1);

InMemoryData.initDataState(data, null);
expect(InMemoryData.inspectFields('Query')).toEqual([
{
arguments: null,
fieldKey: 'test',
fieldName: 'test',
},
]);
});
});

0 comments on commit a04a57c

Please sign in to comment.