From fcd05887866797ec01330aa22888066563862c57 Mon Sep 17 00:00:00 2001 From: rickstaa Date: Sun, 9 Oct 2022 15:18:11 +0200 Subject: [PATCH] test: cleanup tests --- tests/e2e/e2e.test.js | 5 ++++- tests/fetchRepo.test.js | 1 + tests/renderStatsCard.test.js | 20 +++++++++--------- tests/renderTopLanguages.test.js | 36 ++++++++++++++++---------------- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/tests/e2e/e2e.test.js b/tests/e2e/e2e.test.js index ad8086b0..aa023cbd 100644 --- a/tests/e2e/e2e.test.js +++ b/tests/e2e/e2e.test.js @@ -11,7 +11,6 @@ import { renderStatsCard } from "../../src/cards/stats-card.js"; import { renderTopLanguages } from "../../src/cards/top-languages-card.js"; import { renderWakatimeCard } from "../../src/cards/wakatime-card.js"; -// Script variables const REPO = "dummy-cra"; const USER = "grsdummy"; const STATS_DATA = { @@ -26,6 +25,7 @@ const STATS_DATA = { score: 51.01013099671447, }, }; + const LANGS_DATA = { TypeScript: { color: "#3178c6", @@ -48,6 +48,7 @@ const LANGS_DATA = { size: 671, }, }; + const WAKATIME_DATA = { human_readable_range: "last week", is_already_updating: false, @@ -64,6 +65,7 @@ const WAKATIME_DATA = { username: "grsdummy", writes_only: false, }; + const REPOSITORY_DATA = { name: "dummy-cra", nameWithOwner: "grsdummy/dummy-cra", @@ -82,6 +84,7 @@ const REPOSITORY_DATA = { forkCount: 0, starCount: 1, }; + const CACHE_BURST_STRING = `v=${new Date().getTime()}`; describe("Fetch Cards", () => { diff --git a/tests/fetchRepo.test.js b/tests/fetchRepo.test.js index 966f2d89..f74a66ff 100644 --- a/tests/fetchRepo.test.js +++ b/tests/fetchRepo.test.js @@ -23,6 +23,7 @@ const data_user = { organization: null, }, }; + const data_org = { data: { user: null, diff --git a/tests/renderStatsCard.test.js b/tests/renderStatsCard.test.js index d3155986..69708137 100644 --- a/tests/renderStatsCard.test.js +++ b/tests/renderStatsCard.test.js @@ -10,17 +10,17 @@ import "@testing-library/jest-dom"; import { themes } from "../themes/index.js"; -describe("Test renderStatsCard", () => { - const stats = { - name: "Anurag Hazra", - totalStars: 100, - totalCommits: 200, - totalIssues: 300, - totalPRs: 400, - contributedTo: 500, - rank: { level: "A+", score: 40 }, - }; +const stats = { + name: "Anurag Hazra", + totalStars: 100, + totalCommits: 200, + totalIssues: 300, + totalPRs: 400, + contributedTo: 500, + rank: { level: "A+", score: 40 }, +}; +describe("Test renderStatsCard", () => { it("should render correctly", () => { document.body.innerHTML = renderStatsCard(stats); diff --git a/tests/renderTopLanguages.test.js b/tests/renderTopLanguages.test.js index 8c6bcbef..8ae4bbd0 100644 --- a/tests/renderTopLanguages.test.js +++ b/tests/renderTopLanguages.test.js @@ -9,25 +9,25 @@ import "@testing-library/jest-dom"; import { themes } from "../themes/index.js"; -describe("Test renderTopLanguages", () => { - const langs = { - HTML: { - color: "#0f0", - name: "HTML", - size: 200, - }, - javascript: { - color: "#0ff", - name: "javascript", - size: 200, - }, - css: { - color: "#ff0", - name: "css", - size: 100, - }, - }; +const langs = { + HTML: { + color: "#0f0", + name: "HTML", + size: 200, + }, + javascript: { + color: "#0ff", + name: "javascript", + size: 200, + }, + css: { + color: "#ff0", + name: "css", + size: 100, + }, +}; +describe("Test renderTopLanguages", () => { it("should render correctly", () => { document.body.innerHTML = renderTopLanguages(langs);