Skip to content

Commit

Permalink
test: fixed test for collaborator status
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 12, 2025
1 parent 58be1e0 commit 9621700
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/__mocks__/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,9 @@ export const handlers = [
http.post("https://api.github.com/repos/:owner/:repo/issues/:id/comments", () => {
return HttpResponse.json({});
}),
http.get("https://api.github.com/repos/:owner/:repo/collaborators/:user/permission", () => {
return HttpResponse.json({
role_name: "admin",
});
}),
];
13 changes: 12 additions & 1 deletion tests/pre-check.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,18 @@ describe("Pre-check tests", () => {
collectLinkedMergedPulls: jest.fn(() => []),
}));
const patchMock = jest.fn(() => HttpResponse.json({}));
server.use(http.patch("https://api.github.com/repos/ubiquity/work.ubq.fi/issues/69", patchMock, { once: true }));
server.use(
http.patch("https://api.github.com/repos/ubiquity/work.ubq.fi/issues/69", patchMock, { once: true }),
http.get(
"https://api.github.com/repos/:owner/:repo/collaborators/:user/permission",
() => {
return HttpResponse.json({
role_name: "read",
});
},
{ once: true }
)
);
const { run } = await import("../src/run");

const result = await run({
Expand Down

0 comments on commit 9621700

Please sign in to comment.