Skip to content

Commit

Permalink
test: adapt for new octokit.hooks types
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Mar 9, 2021
1 parent e3a8578 commit d2b82de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions test/constructor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,21 @@ describe("Smoke test", () => {
});

octokit.hook.wrap("request", (request, options) => {
// @ts-ignore
expect(options.request.foo).toEqual("bar");
return "ok";
return {
data: { ok: true },
headers: {},
status: 200,
url: "https://example.com",
};
});

return octokit
.request("/")

.then((response) => {
expect(response).toEqual("ok");
expect(response.data.ok).toEqual(true);
});
});
});
4 changes: 3 additions & 1 deletion test/hook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe("octokit.hook", () => {
qux: "quux",
request: {
fetch: mock,
// @ts-ignore
hook: options.request.hook,
},
});
Expand Down Expand Up @@ -180,11 +181,12 @@ describe("octokit.hook", () => {
format: "",
},
request: {
// @ts-ignore
hook: options.request.hook,
},
});

return { data: { ok: true } };
return { data: { ok: true }, headers: {}, status: 200, url: "" };
});

const { data } = await octokit.request("/");
Expand Down

0 comments on commit d2b82de

Please sign in to comment.