mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 21:05:16 +00:00
tests: Add Wakatime fetcher error response test to increase coverage (#3112)
This commit is contained in:
parent
4e69e3a358
commit
272c712a36
1 changed files with 9 additions and 1 deletions
|
|
@ -205,13 +205,21 @@ describe("Wakatime fetcher", () => {
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw error", async () => {
|
it("should throw error if username param missing", async () => {
|
||||||
mock.onGet(/\/https:\/\/wakatime\.com\/api/).reply(404, wakaTimeData);
|
mock.onGet(/\/https:\/\/wakatime\.com\/api/).reply(404, wakaTimeData);
|
||||||
|
|
||||||
await expect(fetchWakatimeStats("noone")).rejects.toThrow(
|
await expect(fetchWakatimeStats("noone")).rejects.toThrow(
|
||||||
'Missing params "username" make sure you pass the parameters in URL',
|
'Missing params "username" make sure you pass the parameters in URL',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should throw error if username is not found", async () => {
|
||||||
|
mock.onGet(/\/https:\/\/wakatime\.com\/api/).reply(404, wakaTimeData);
|
||||||
|
|
||||||
|
await expect(fetchWakatimeStats({ username: "noone" })).rejects.toThrow(
|
||||||
|
"Could not resolve to a User with the login of 'noone'",
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
export { wakaTimeData };
|
export { wakaTimeData };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue