mirror of
https://github.com/Aviortheking/codestats-readme.git
synced 2025-08-05 02:11:59 +00:00
feat: Add count_private flag to count private contributions (#148)
* Add private contributions count * Remove unused var and add tests * Update readme * fix: tests & minor code formating * docs: updated docs Co-authored-by: anuraghazra <hazru.anurag@gmail.com>
This commit is contained in:
@@ -9,7 +9,7 @@ const data = {
|
||||
user: {
|
||||
name: "Anurag Hazra",
|
||||
repositoriesContributedTo: { totalCount: 61 },
|
||||
contributionsCollection: { totalCommitContributions: 100 },
|
||||
contributionsCollection: { totalCommitContributions: 100, restrictedContributionsCount: 50 },
|
||||
pullRequests: { totalCount: 300 },
|
||||
issues: { totalCount: 200 },
|
||||
followers: { totalCount: 100 },
|
||||
@@ -77,4 +77,29 @@ describe("Test fetchStats", () => {
|
||||
"Could not resolve to a User with the login of 'noname'."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("should fetch and add private contributions", async () => {
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data);
|
||||
|
||||
let stats = await fetchStats("anuraghazra", true);
|
||||
const rank = calculateRank({
|
||||
totalCommits: 150,
|
||||
totalRepos: 5,
|
||||
followers: 100,
|
||||
contributions: 61,
|
||||
stargazers: 400,
|
||||
prs: 300,
|
||||
issues: 200,
|
||||
});
|
||||
|
||||
expect(stats).toStrictEqual({
|
||||
contributedTo: 61,
|
||||
name: "Anurag Hazra",
|
||||
totalCommits: 150,
|
||||
totalIssues: 200,
|
||||
totalPRs: 300,
|
||||
totalStars: 400,
|
||||
rank,
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user