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

Commit 2e52b90

Browse files
amacleay-coherefabien0102
authored andcommitted
Add refetch return value test assertions
1 parent 925f2a2 commit 2e52b90

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/useGet.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ describe("useGet hook", () => {
738738
nock("https://my-awesome-api.fake")
739739
.get("/")
740740
.reply(200, { id: 2 });
741-
children.mock.calls[1][0].refetch();
741+
expect(await children.mock.calls[1][0].refetch()).toEqual({ id: 2 });
742742
await wait(() => expect(children).toHaveBeenCalledTimes(4));
743743

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

828828
// transition state
@@ -1543,7 +1543,7 @@ describe("useGet hook", () => {
15431543
wrapper,
15441544
},
15451545
);
1546-
await result.current.refetch({ pathParams: { id: "one" } });
1546+
expect(await result.current.refetch({ pathParams: { id: "one" } })).toEqual({ id: 1 });
15471547

15481548
await wait(() =>
15491549
expect(result.current).toMatchObject({
@@ -1572,7 +1572,7 @@ describe("useGet hook", () => {
15721572
wrapper,
15731573
},
15741574
);
1575-
await result.current.refetch({ pathParams: { id: "one" } });
1575+
expect(await result.current.refetch({ pathParams: { id: "one" } })).toEqual({ id: 1 });
15761576

15771577
expect(result.current).toMatchObject({
15781578
error: null,

0 commit comments

Comments
 (0)