From 234cc150741dbc8b442bb8bf2980cac67f2b78db Mon Sep 17 00:00:00 2001 From: Rangga Fajar Oktariansyah <86386385+FajarKim@users.noreply.github.com> Date: Sat, 2 Dec 2023 20:17:27 +0700 Subject: [PATCH] tests: fixed all tests performance --- tests/randomToken.test.ts | 2 +- tests/renderAPIStatsCard.test.ts | 1 - tests/renderDocsReadme.test.ts | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/randomToken.test.ts b/tests/randomToken.test.ts index d789415..cab3c7c 100644 --- a/tests/randomToken.test.ts +++ b/tests/randomToken.test.ts @@ -1,6 +1,6 @@ import getRandomToken from "../src/getRandomToken"; -describe("getRandomToken", () => { +describe("Test Get Random Token", () => { it("should generate a random token without Bearer prefix by default", () => { const token = getRandomToken(false); diff --git a/tests/renderAPIStatsCard.test.ts b/tests/renderAPIStatsCard.test.ts index e13365a..9da407e 100644 --- a/tests/renderAPIStatsCard.test.ts +++ b/tests/renderAPIStatsCard.test.ts @@ -1,4 +1,3 @@ -// __tests__/readmeStats.test.ts import readmeStats from "../api/index"; import getData from "../src/getData"; import cardStyle from "../src/card"; diff --git a/tests/renderDocsReadme.test.ts b/tests/renderDocsReadme.test.ts index 73e7cec..dcd977c 100644 --- a/tests/renderDocsReadme.test.ts +++ b/tests/renderDocsReadme.test.ts @@ -1,20 +1,20 @@ -import fs from 'fs'; -import { generateReadmeThemes } from '../scripts/generate-theme-doc'; -import { generateReadmeLocales } from '../scripts/generate-translation-doc'; +import fs from "fs"; +import { generateReadmeThemes } from "../scripts/generate-theme-doc"; +import { generateReadmeLocales } from "../scripts/generate-translation-doc"; -jest.mock('fs'); +jest.mock("fs"); -describe('Test Generate Readme Docs', () => { - it('should generate the README content themes correctly', () => { - const username = 'FajarKim'; +describe("Test Generate Readme Docs", () => { + it("should generate the README content themes correctly", () => { + const username = "FajarKim"; const generatedReadme = generateReadmeThemes(username); - expect(fs.writeFileSync).toHaveBeenCalledWith('./themes/README.md', generatedReadme); + expect(fs.writeFileSync).toHaveBeenCalledWith("./themes/README.md", generatedReadme); }); - it('should generate the README content locales correctly', () => { + it("should generate the README content locales correctly", () => { const generatedReadme = generateReadmeLocales(); - expect(fs.writeFileSync).toHaveBeenCalledWith('./docs/translations.md', generatedReadme); + expect(fs.writeFileSync).toHaveBeenCalledWith("./docs/translations.md", generatedReadme); }); });