Tests: Add top langs endpoint blacklist test (#3135)

This commit is contained in:
Alexandr Garbuzov 2023-08-24 08:39:38 +03:00 committed by GitHub
parent a5ddf2632b
commit 4ccad77d44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"));
});
});