mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2025-01-24 13:59:08 +08:00
Tests: Add pin endpoint missing params test (#3151)
This commit is contained in:
parent
1c91d1ac43
commit
b6156a8688
@ -179,4 +179,24 @@ describe("Test /api/pin", () => {
|
||||
renderError("Something went wrong", "Language not found"),
|
||||
);
|
||||
});
|
||||
|
||||
it("should render error card if missing required parameters", async () => {
|
||||
const req = {
|
||||
query: {},
|
||||
};
|
||||
const res = {
|
||||
setHeader: jest.fn(),
|
||||
send: jest.fn(),
|
||||
};
|
||||
|
||||
await pin(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
renderError(
|
||||
'Missing params "username", "repo" make sure you pass the parameters in URL',
|
||||
"/api/pin?username=USERNAME&repo=REPO_NAME",
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user