Skip to content

Commit

Permalink
Tests: Stats card: Add invalid username fetcher test (anuraghazra#3148)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 committed Dec 22, 2023
1 parent ac4702c commit 457bb3f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/fetchStats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,33 @@ describe("Test fetchStats", () => {
});
});

it("should return 0 commits when all_commits true and invalid username", async () => {
let stats = await fetchStats("asdf///---", true);
expect(stats).toStrictEqual({
contributedTo: 61,
name: "Anurag Hazra",
totalCommits: 0,
totalIssues: 200,
totalPRs: 300,
totalPRsMerged: 240,
mergedPRsPercentage: 80,
totalReviews: 50,
totalStars: 300,
totalDiscussionsStarted: 10,
totalDiscussionsAnswered: 40,
rank: calculateRank({
all_commits: true,
commits: 0,
prs: 300,
reviews: 50,
issues: 200,
repos: 5,
stars: 300,
followers: 100,
}),
});
});

it("should exclude stars of the `test-repo-1` repository", async () => {
mock
.onGet("https://api.github.com/search/commits?q=author:anuraghazra")
Expand Down

0 comments on commit 457bb3f

Please sign in to comment.