diff --git a/tests/top-langs.test.js b/tests/top-langs.test.js index 3f4e594aa7295a..f1c7d0082f38a3 100644 --- a/tests/top-langs.test.js +++ b/tests/top-langs.test.js @@ -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")); + }); });