From 5c688f9e7c093e43e7108a14536db29f11795901 Mon Sep 17 00:00:00 2001 From: Alexandr Garbuzov Date: Thu, 24 Aug 2023 09:08:22 +0300 Subject: [PATCH] Tests: Add pin endpoint blacklist test (#3136) --- tests/pin.test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/pin.test.js b/tests/pin.test.js index ad63fe0..90e57c2 100644 --- a/tests/pin.test.js +++ b/tests/pin.test.js @@ -138,4 +138,23 @@ describe("Test /api/pin", () => { renderError("Organization Repository Not found"), ); }); + + it("should render error card if username in blacklist", async () => { + const req = { + query: { + username: "renovate-bot", + repo: "convoychat", + }, + }; + const res = { + setHeader: jest.fn(), + send: jest.fn(), + }; + mock.onPost("https://api.github.com/graphql").reply(200, data_user); + + await pin(req, res); + + expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml"); + expect(res.send).toBeCalledWith(renderError("Something went wrong")); + }); });