mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 21:05:16 +00:00
Tests: Add top langs endpoint wrong locale test (#3142)
This commit is contained in:
parent
5c688f9e7c
commit
2cf933c81a
1 changed files with 21 additions and 0 deletions
|
|
@ -185,4 +185,25 @@ describe("Test /api/top-langs", () => {
|
||||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||||
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
|
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should render error card if wrong locale provided", async () => {
|
||||||
|
const req = {
|
||||||
|
query: {
|
||||||
|
username: "anuraghazra",
|
||||||
|
locale: "asdf",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const res = {
|
||||||
|
setHeader: jest.fn(),
|
||||||
|
send: jest.fn(),
|
||||||
|
};
|
||||||
|
mock.onPost("https://api.github.com/graphql").reply(200, data_langs);
|
||||||
|
|
||||||
|
await topLangs(req, res);
|
||||||
|
|
||||||
|
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||||
|
expect(res.send).toBeCalledWith(
|
||||||
|
renderError("Something went wrong", "Locale not found"),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue