Skip to content

Commit

Permalink
Tests: Add top langs endpoint blacklist test (anuraghazra#3135)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 committed Dec 22, 2023
1 parent f32c79e commit 94a9a93
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/top-langs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,22 @@ describe("Test /api/top-langs", () => {
renderError("Something went wrong", "Incorrect layout input"),
);
});

it("should render error card if username in blacklist", async () => {
const req = {
query: {
username: "renovate-bot",
},
};
const res = {
setHeader: jest.fn(),
send: jest.fn(),
};
mock.onPost("https://api.github.com/graphql").reply(200, data_langs);

await topLangs(req, res);

expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
});
});

0 comments on commit 94a9a93

Please sign in to comment.