Skip to content

Commit

Permalink
[WIP] Adjust tests after changes to address issue #9293.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Jun 28, 2023
1 parent 623d259 commit 99b5555
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/__tests__/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,13 @@ describe('client', () => {
});

return client.query({ query }).then(({ data }) => {
expect(data).toEqual(result.data);
expect(data).toEqual({
todos: [{
__typename: 'Todo',
id: '1',
name: 'Todo 1',
}],
});
}).then(resolve, reject);
});

Expand Down
1 change: 1 addition & 0 deletions src/core/__tests__/QueryManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,7 @@ describe('QueryManager', () => {
data: {
info: {},
},
partial: true,
});
} else if (count === 4) {
expect(result).toEqual({
Expand Down
17 changes: 9 additions & 8 deletions src/react/hooks/__tests__/useQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5011,18 +5011,19 @@ describe('useQuery Hook', () => {
await waitFor(() => {
expect(result.current.loading).toBe(false);
}, { interval: 1 });
expect(result.current.data).toEqual(carData);

const { vine, ...carWithoutVine } = carData.cars[0];
expect(result.current.data).toEqual({
...carData,
cars: [carWithoutVine],
});
expect(result.current.error).toBeUndefined();

expect(errorSpy).toHaveBeenCalled();
expect(errorSpy).toHaveBeenLastCalledWith(
`Missing field '%s' while writing result %o`, 'vin', {
id: 1,
make: "Audi",
model: "RS8",
vine: "DOLLADOLLABILL",
__typename: "Car"
}
`Missing field 'vin' while writing result ${
JSON.stringify(carData.cars[0], null, 2)
}`
);
errorSpy.mockRestore();
});
Expand Down

0 comments on commit 99b5555

Please sign in to comment.