mirror of
https://github.com/System-End/github-readme-stats.git
synced 2026-04-19 21:05:16 +00:00
test: adds language card 'exclude_repo' test (#1452)
This commit is contained in:
parent
0745806f68
commit
397e321c2a
1 changed files with 22 additions and 0 deletions
|
|
@ -15,16 +15,19 @@ const data_langs = {
|
|||
repositories: {
|
||||
nodes: [
|
||||
{
|
||||
name: "test-repo-1",
|
||||
languages: {
|
||||
edges: [{ size: 100, node: { color: "#0f0", name: "HTML" } }],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "test-repo-2",
|
||||
languages: {
|
||||
edges: [{ size: 100, node: { color: "#0f0", name: "HTML" } }],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "test-repo-3",
|
||||
languages: {
|
||||
edges: [
|
||||
{ size: 100, node: { color: "#0ff", name: "javascript" } },
|
||||
|
|
@ -32,6 +35,7 @@ const data_langs = {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "test-repo-4",
|
||||
languages: {
|
||||
edges: [
|
||||
{ size: 100, node: { color: "#0ff", name: "javascript" } },
|
||||
|
|
@ -74,6 +78,24 @@ describe("FetchTopLanguages", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("should fetch correct language data while excluding the 'test-repo-1' repository", async () => {
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data_langs);
|
||||
|
||||
let repo = await fetchTopLanguages("anuraghazra", exclude_repo=["test-repo-1"]);
|
||||
expect(repo).toStrictEqual({
|
||||
HTML: {
|
||||
color: "#0f0",
|
||||
name: "HTML",
|
||||
size: 100,
|
||||
},
|
||||
javascript: {
|
||||
color: "#0ff",
|
||||
name: "javascript",
|
||||
size: 200,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should throw error", async () => {
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, error);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue