From 1b4ea7c880f8d1e35a2e702827e2bd0667478919 Mon Sep 17 00:00:00 2001 From: kevkevin Date: Wed, 8 Nov 2023 13:13:43 -0600 Subject: [PATCH] test: moved the tests into utils folder (#577) --- package.json | 31 +++++-------------- .../BudgetStep/{ => utils}/__tests__/index.ts | 2 +- .../{ => utils}/__tests__/index.ts | 2 +- .../SourceStep/{ => utils}/__tests__/index.ts | 2 +- .../{ => utils}/__tests__/index.ts | 2 +- 5 files changed, 11 insertions(+), 28 deletions(-) rename src/components/AddContentModal/BudgetStep/{ => utils}/__tests__/index.ts (90%) rename src/components/AddContentModal/LocationStep/{ => utils}/__tests__/index.ts (95%) rename src/components/AddContentModal/SourceStep/{ => utils}/__tests__/index.ts (96%) rename src/components/AddContentModal/{ => utils}/__tests__/index.ts (95%) diff --git a/package.json b/package.json index 6bc3f10e1..adb410dbf 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "preview": "vite preview --port 3004", "build-preview": "yarn run build && yarn run preview", "build-preview-e2e": "VITE_APP_IS_E2E=true yarn run build && vite preview --port 3000", - "test": "NODE_ENV=test yarn jest", + "test": "NODE_ENV=test yarn jest --coverage --no-cache", "test-start": "yarn jest --watch", "test-coverage": "node ./cypress/coverageTest.js", "cy-open": "cypress open", @@ -88,23 +88,17 @@ "lint": "eslint src --max-warnings 24" }, "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] + "extends": ["react-app", "react-app/jest"] }, "jest": { "collectCoverage": true, - "collectCoverageFrom": [ - "./src/**/*.js", - "./src/**/*.ts" - ], + "collectCoverageFrom": ["./src/**/*.js", "./src/**/*.ts"], "coverageThreshold": { "global": { "lines": 0 }, "./src/components/**/utils/**.ts": { - "lines": 92 + "lines": 100 }, "./src/utils/": { "lines": 23, @@ -125,16 +119,8 @@ } }, "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "production": [">0.2%", "not dead", "not op_mini all"], + "development": ["last 1 chrome version", "last 1 firefox version", "last 1 safari version"] }, "resolutions": { "react-error-overlay": "6.0.9" @@ -205,10 +191,7 @@ "sourceMap": false, "all": true, "include": "src/**/*.{js,jsx,ts,tsx}", - "reporter": [ - "html", - "text-summary" - ] + "reporter": ["html", "text-summary"] }, "coverage": { "min": 30 diff --git a/src/components/AddContentModal/BudgetStep/__tests__/index.ts b/src/components/AddContentModal/BudgetStep/utils/__tests__/index.ts similarity index 90% rename from src/components/AddContentModal/BudgetStep/__tests__/index.ts rename to src/components/AddContentModal/BudgetStep/utils/__tests__/index.ts index 010b6f268..a5ba38cf8 100644 --- a/src/components/AddContentModal/BudgetStep/__tests__/index.ts +++ b/src/components/AddContentModal/BudgetStep/utils/__tests__/index.ts @@ -1,4 +1,4 @@ -import { formatBudget } from '../utils' +import { formatBudget } from '..' describe('formatBudget', () => { /** diff --git a/src/components/AddContentModal/LocationStep/__tests__/index.ts b/src/components/AddContentModal/LocationStep/utils/__tests__/index.ts similarity index 95% rename from src/components/AddContentModal/LocationStep/__tests__/index.ts rename to src/components/AddContentModal/LocationStep/utils/__tests__/index.ts index 42a7dcf0e..c9ac2bb71 100644 --- a/src/components/AddContentModal/LocationStep/__tests__/index.ts +++ b/src/components/AddContentModal/LocationStep/utils/__tests__/index.ts @@ -1,4 +1,4 @@ -import { validateLatitude, validateLongitude } from '../utils' +import { validateLatitude, validateLongitude } from '..' describe('validateLongitude', () => { /** diff --git a/src/components/AddContentModal/SourceStep/__tests__/index.ts b/src/components/AddContentModal/SourceStep/utils/__tests__/index.ts similarity index 96% rename from src/components/AddContentModal/SourceStep/__tests__/index.ts rename to src/components/AddContentModal/SourceStep/utils/__tests__/index.ts index d50e93bff..ce8d54065 100644 --- a/src/components/AddContentModal/SourceStep/__tests__/index.ts +++ b/src/components/AddContentModal/SourceStep/utils/__tests__/index.ts @@ -1,4 +1,4 @@ -import { twitterOrYoutubeRegexOrMp3 } from '../utils' +import { twitterOrYoutubeRegexOrMp3 } from '..' describe('twitterOrYoutubeRegexOrMp3', () => { const regex = new RegExp(twitterOrYoutubeRegexOrMp3) diff --git a/src/components/AddContentModal/__tests__/index.ts b/src/components/AddContentModal/utils/__tests__/index.ts similarity index 95% rename from src/components/AddContentModal/__tests__/index.ts rename to src/components/AddContentModal/utils/__tests__/index.ts index 75475192a..8edf0fcf6 100644 --- a/src/components/AddContentModal/__tests__/index.ts +++ b/src/components/AddContentModal/utils/__tests__/index.ts @@ -1,4 +1,4 @@ -import { getInputType } from '../utils' +import { getInputType } from '..' import { LINK, TWITTER_SOURCE, WEB_PAGE } from '~/constants' describe('youtubeRegex', () => {