mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-05-23 12:24:59 +00:00
test: adds language card 'exclude_repo' test (#1452)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user