Skip to content

Commit

Permalink
Tests: Add gist endpoint wrong locale test (anuraghazra#3127)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 authored and setdebarr committed Jan 12, 2024
1 parent a7a95e6 commit a5d7aad
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/gist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,24 @@ describe("Test /api/gist", () => {
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
expect(res.send).toBeCalledWith(renderError("Gist not found"));
});

it("should render error if wrong locale is provided", async () => {
const req = {
query: {
id: "bbfce31e0217a3689c8d961a356cb10d",
locale: "asdf",
},
};
const res = {
setHeader: jest.fn(),
send: jest.fn(),
};

await gist(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 a5d7aad

Please sign in to comment.