Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
Add refetch return value test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
amacleay-cohere authored and fabien0102 committed Oct 7, 2021
1 parent 925f2a2 commit 2e52b90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/useGet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ describe("useGet hook", () => {
nock("https://my-awesome-api.fake")
.get("/")
.reply(200, { id: 2 });
children.mock.calls[1][0].refetch();
expect(await children.mock.calls[1][0].refetch()).toEqual({ id: 2 });
await wait(() => expect(children).toHaveBeenCalledTimes(4));

// transition state
Expand Down Expand Up @@ -822,7 +822,7 @@ describe("useGet hook", () => {
nock("https://my-awesome-api.fake")
.get("/plop")
.reply(200, { id: 2 });
children.mock.calls[1][0].refetch({ path: "/plop" });
expect(await children.mock.calls[1][0].refetch({ path: "/plop" })).toEqual({ id: 2 });
await wait(() => expect(children).toHaveBeenCalledTimes(4));

// transition state
Expand Down Expand Up @@ -1543,7 +1543,7 @@ describe("useGet hook", () => {
wrapper,
},
);
await result.current.refetch({ pathParams: { id: "one" } });
expect(await result.current.refetch({ pathParams: { id: "one" } })).toEqual({ id: 1 });

await wait(() =>
expect(result.current).toMatchObject({
Expand Down Expand Up @@ -1572,7 +1572,7 @@ describe("useGet hook", () => {
wrapper,
},
);
await result.current.refetch({ pathParams: { id: "one" } });
expect(await result.current.refetch({ pathParams: { id: "one" } })).toEqual({ id: 1 });

expect(result.current).toMatchObject({
error: null,
Expand Down

0 comments on commit 2e52b90

Please sign in to comment.