Skip to content

Commit

Permalink
add one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Apr 23, 2024
1 parent fb6f98f commit 1e16372
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/react-urql/src/hooks/useFragment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,33 @@ describe('useFragment', () => {
});
});

it('should correctly take a different fragment to mask data', () => {
const { result } = renderHook(
() =>
useFragment({
query: `fragment x on X { foo bar } fragment TodoFields on Todo { id name __typename }`,
name: 'TodoFields',
data: {
__typename: 'Todo',
id: '1',
name: 'Learn urql',
completed: true,
},
}),
{ initialProps: { query: mockQuery } }
);

const state = result.current;
expect(state).toEqual({
fetching: false,
data: {
__typename: 'Todo',
id: '1',
name: 'Learn urql',
},
});
});

it('should correctly mask data w/ null attribute', () => {
const { result } = renderHook(
({ query }) =>
Expand Down

0 comments on commit 1e16372

Please sign in to comment.