mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-03 00:17:58 +00:00
fix: fetch all repos for for the stats card (#2100)
* fetch all stars * stop fetching when there are repos with zero stars * remove not needed parameters from the query * add docstring * removed not needed mock * style: update formatting Co-authored-by: rickstaa <rick.staa@outlook.com>
This commit is contained in:
co-authored by
rickstaa
parent
acbc03dc0f
commit
af97e5765b
+18
-2
@@ -40,7 +40,20 @@ const data = {
|
||||
followers: { totalCount: 0 },
|
||||
repositories: {
|
||||
totalCount: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const repositoriesData = {
|
||||
data: {
|
||||
user: {
|
||||
repositories: {
|
||||
nodes: [{ stargazers: { totalCount: 100 } }],
|
||||
pageInfo: {
|
||||
hasNextPage: false,
|
||||
cursor: "cursor",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -70,7 +83,11 @@ const faker = (query, data) => {
|
||||
setHeader: jest.fn(),
|
||||
send: jest.fn(),
|
||||
};
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data);
|
||||
mock
|
||||
.onPost("https://api.github.com/graphql")
|
||||
.replyOnce(200, data)
|
||||
.onPost("https://api.github.com/graphql")
|
||||
.replyOnce(200, repositoriesData);
|
||||
|
||||
return { req, res };
|
||||
};
|
||||
@@ -138,7 +155,6 @@ describe("Test /api/", () => {
|
||||
|
||||
it("should have proper cache", async () => {
|
||||
const { req, res } = faker({}, data);
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data);
|
||||
|
||||
await api(req, res);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user