mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-07-16 16:17:04 +00:00
Tests: Add pin endpoint missing params test (#3151)
This commit is contained in:
@@ -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",
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user