mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2024-12-21 06:11:29 +08:00
tests: Add Wakatime fetcher error response test to increase coverage (#3112)
This commit is contained in:
parent
4e69e3a358
commit
272c712a36
@ -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…
Reference in New Issue
Block a user