test: cleanup tests

This commit is contained in:
rickstaa 2022-10-09 15:18:11 +02:00
parent 60012707c7
commit fcd0588786
No known key found for this signature in database
GPG Key ID: 0BD7401D30D23E53
4 changed files with 33 additions and 29 deletions

View File

@ -11,7 +11,6 @@ import { renderStatsCard } from "../../src/cards/stats-card.js";
import { renderTopLanguages } from "../../src/cards/top-languages-card.js"; import { renderTopLanguages } from "../../src/cards/top-languages-card.js";
import { renderWakatimeCard } from "../../src/cards/wakatime-card.js"; import { renderWakatimeCard } from "../../src/cards/wakatime-card.js";
// Script variables
const REPO = "dummy-cra"; const REPO = "dummy-cra";
const USER = "grsdummy"; const USER = "grsdummy";
const STATS_DATA = { const STATS_DATA = {
@ -26,6 +25,7 @@ const STATS_DATA = {
score: 51.01013099671447, score: 51.01013099671447,
}, },
}; };
const LANGS_DATA = { const LANGS_DATA = {
TypeScript: { TypeScript: {
color: "#3178c6", color: "#3178c6",
@ -48,6 +48,7 @@ const LANGS_DATA = {
size: 671, size: 671,
}, },
}; };
const WAKATIME_DATA = { const WAKATIME_DATA = {
human_readable_range: "last week", human_readable_range: "last week",
is_already_updating: false, is_already_updating: false,
@ -64,6 +65,7 @@ const WAKATIME_DATA = {
username: "grsdummy", username: "grsdummy",
writes_only: false, writes_only: false,
}; };
const REPOSITORY_DATA = { const REPOSITORY_DATA = {
name: "dummy-cra", name: "dummy-cra",
nameWithOwner: "grsdummy/dummy-cra", nameWithOwner: "grsdummy/dummy-cra",
@ -82,6 +84,7 @@ const REPOSITORY_DATA = {
forkCount: 0, forkCount: 0,
starCount: 1, starCount: 1,
}; };
const CACHE_BURST_STRING = `v=${new Date().getTime()}`; const CACHE_BURST_STRING = `v=${new Date().getTime()}`;
describe("Fetch Cards", () => { describe("Fetch Cards", () => {

View File

@ -23,6 +23,7 @@ const data_user = {
organization: null, organization: null,
}, },
}; };
const data_org = { const data_org = {
data: { data: {
user: null, user: null,

View File

@ -10,17 +10,17 @@ import "@testing-library/jest-dom";
import { themes } from "../themes/index.js"; import { themes } from "../themes/index.js";
describe("Test renderStatsCard", () => { const stats = {
const stats = { name: "Anurag Hazra",
name: "Anurag Hazra", totalStars: 100,
totalStars: 100, totalCommits: 200,
totalCommits: 200, totalIssues: 300,
totalIssues: 300, totalPRs: 400,
totalPRs: 400, contributedTo: 500,
contributedTo: 500, rank: { level: "A+", score: 40 },
rank: { level: "A+", score: 40 }, };
};
describe("Test renderStatsCard", () => {
it("should render correctly", () => { it("should render correctly", () => {
document.body.innerHTML = renderStatsCard(stats); document.body.innerHTML = renderStatsCard(stats);

View File

@ -9,25 +9,25 @@ import "@testing-library/jest-dom";
import { themes } from "../themes/index.js"; import { themes } from "../themes/index.js";
describe("Test renderTopLanguages", () => { const langs = {
const langs = { HTML: {
HTML: { color: "#0f0",
color: "#0f0", name: "HTML",
name: "HTML", size: 200,
size: 200, },
}, javascript: {
javascript: { color: "#0ff",
color: "#0ff", name: "javascript",
name: "javascript", size: 200,
size: 200, },
}, css: {
css: { color: "#ff0",
color: "#ff0", name: "css",
name: "css", size: 100,
size: 100, },
}, };
};
describe("Test renderTopLanguages", () => {
it("should render correctly", () => { it("should render correctly", () => {
document.body.innerHTML = renderTopLanguages(langs); document.body.innerHTML = renderTopLanguages(langs);