tests: add pin endpoint wrong locale test (#3143)

This commit is contained in:
Alexandr Garbuzov 2023-08-25 10:21:12 +03:00 committed by GitHub
parent 2cf933c81a
commit e8b9ccf203
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,4 +157,26 @@ describe("Test /api/pin", () => {
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
});
it("should render error card if wrong locale provided", async () => {
const req = {
query: {
username: "anuraghazra",
repo: "convoychat",
locale: "asdf",
},
};
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", "Language not found"),
);
});
});