Skip to content

Commit

Permalink
tests: add pin endpoint wrong locale test (anuraghazra#3143)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 authored and setdebarr committed Jan 12, 2024
1 parent e4dcf63 commit 00fd390
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/pin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
);
});
});

0 comments on commit 00fd390

Please sign in to comment.