Skip to content

Commit

Permalink
Tests: Add top langs endpoint blacklist test (#3135)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 authored Aug 24, 2023
1 parent a5ddf26 commit 4ccad77
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 4ccad77

Please sign in to comment.