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 authored and setdebarr committed Jan 12, 2024
1 parent 052cf71 commit c422a71
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 c422a71

Please sign in to comment.