mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-09-03 00:17:58 +00:00
refactor: refactor repo card (#1325)
* refactor: refactored repo-card * test: fix tests * test: fixed tests * fix: unprovided description error
This commit is contained in:
+11
-4
@@ -19,14 +19,14 @@ const data_repo = {
|
||||
|
||||
const data_user = {
|
||||
data: {
|
||||
user: { repository: data_repo },
|
||||
user: { repository: data_repo.repository },
|
||||
organization: null,
|
||||
},
|
||||
};
|
||||
const data_org = {
|
||||
data: {
|
||||
user: null,
|
||||
organization: { repository: data_repo },
|
||||
organization: { repository: data_repo.repository },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -41,14 +41,21 @@ describe("Test fetchRepo", () => {
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data_user);
|
||||
|
||||
let repo = await fetchRepo("anuraghazra", "convoychat");
|
||||
expect(repo).toStrictEqual(data_repo);
|
||||
|
||||
expect(repo).toStrictEqual({
|
||||
...data_repo.repository,
|
||||
starCount: data_repo.repository.stargazers.totalCount,
|
||||
});
|
||||
});
|
||||
|
||||
it("should fetch correct org repo", async () => {
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data_org);
|
||||
|
||||
let repo = await fetchRepo("anuraghazra", "convoychat");
|
||||
expect(repo).toStrictEqual(data_repo);
|
||||
expect(repo).toStrictEqual({
|
||||
...data_repo.repository,
|
||||
starCount: data_repo.repository.stargazers.totalCount,
|
||||
});
|
||||
});
|
||||
|
||||
it("should throw error if user is found but repo is null", async () => {
|
||||
|
||||
Reference in New Issue
Block a user