mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 19:55:16 +00:00
Tests: Add gist endpoint wrong locale test (#3127)
This commit is contained in:
parent
fb45135b4f
commit
4cf33ad1bf
1 changed files with 20 additions and 0 deletions
|
|
@ -150,4 +150,24 @@ describe("Test /api/gist", () => {
|
||||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||||
expect(res.send).toBeCalledWith(renderError("Gist not found"));
|
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"),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue