Skip to content
Merged
Show file tree
Hide file tree
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
24 changes: 16 additions & 8 deletions src/react/hooks/__tests__/useFragment.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,11 @@ describe("useFragment", () => {

describe("return value `complete` property", () => {
let cache: InMemoryCache, wrapper: React.FunctionComponent;
const ItemFragment = gql`
const ItemFragment: TypedDocumentNode<{
__typename: "Item";
id: number;
text: string;
}> = gql`
fragment ItemFragment on Item {
id
text
Expand Down Expand Up @@ -1876,13 +1880,17 @@ describe("useFragment", () => {
});

test("if only partial data is available, `complete` is `false`", () => {
cache.writeFragment({
fragment: ItemFragment,
data: {
__typename: "Item",
id: 5,
},
});
{
using _ = spyOnConsole("error");
cache.writeFragment({
fragment: ItemFragment,
// @ts-expect-error purposefully omitting text
data: {
__typename: "Item",
id: 5,
},
});
}

const { result } = renderHook(
() =>
Expand Down
5 changes: 3 additions & 2 deletions src/react/hooks/__tests__/useQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ describe("useQuery Hook", () => {
update(cache, { data }) {
cache.writeQuery({
query,
data: { hello: data.updateGreeting },
data: { hello: data.updateName },
});
},
}),
Expand Down Expand Up @@ -3559,6 +3559,7 @@ describe("useQuery Hook", () => {
cache={cache}
// This test uses fake timers and does not expect a delay
mockLinkDefaultOptions={{ delay: 0 }}
showWarnings={false}
>
{children}
</MockedProvider>
Expand Down Expand Up @@ -3724,7 +3725,7 @@ describe("useQuery Hook", () => {
request: { query },
result: {
data: { hello: null },
errors: [new GraphQLError('Could not fetch "hello"')],
errors: [{ message: 'Could not fetch "hello"' }],
},
},
];
Expand Down
Loading