From cbb662d2aa24125332472ff055980558b2ba8877 Mon Sep 17 00:00:00 2001 From: rafidoth Date: Mon, 16 Dec 2024 17:09:23 +0600 Subject: [PATCH 1/3] Refactor: Updated PageNotFound component test from Jest to Vitest --- .../{PageNotFound.test.tsx => PageNotFound.spec.tsx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/screens/PageNotFound/{PageNotFound.test.tsx => PageNotFound.spec.tsx} (97%) diff --git a/src/screens/PageNotFound/PageNotFound.test.tsx b/src/screens/PageNotFound/PageNotFound.spec.tsx similarity index 97% rename from src/screens/PageNotFound/PageNotFound.test.tsx rename to src/screens/PageNotFound/PageNotFound.spec.tsx index 501d9f7ef3..d8f5f1692b 100644 --- a/src/screens/PageNotFound/PageNotFound.test.tsx +++ b/src/screens/PageNotFound/PageNotFound.spec.tsx @@ -8,7 +8,7 @@ import { store } from 'state/store'; import PageNotFound from './PageNotFound'; import i18nForTest from 'utils/i18nForTest'; import useLocalStorage from 'utils/useLocalstorage'; - +import { test, expect, describe } from 'vitest'; const { setItem } = useLocalStorage(); describe('Testing Page not found component', () => { From 8e6645073682534a5876107163b958be12214e3e Mon Sep 17 00:00:00 2001 From: rafidoth Date: Tue, 17 Dec 2024 01:42:08 +0600 Subject: [PATCH 2/3] added css parsing configs in jest configuration --- __mocks__/styleMock.ts | 2 ++ jest.config.js | 2 ++ package-lock.json | 1 + 3 files changed, 5 insertions(+) create mode 100644 __mocks__/styleMock.ts diff --git a/__mocks__/styleMock.ts b/__mocks__/styleMock.ts new file mode 100644 index 0000000000..663f4ebaa7 --- /dev/null +++ b/__mocks__/styleMock.ts @@ -0,0 +1,2 @@ +// __mocks__/styleMock.js +module.exports = {}; diff --git a/jest.config.js b/jest.config.js index 3083bcda4f..e91ff820bb 100644 --- a/jest.config.js +++ b/jest.config.js @@ -42,6 +42,8 @@ export default { '\\.svg\\?react$': '/scripts/__mocks__/fileMock.js', '\\.svg$': '/scripts/__mocks__/fileMock.js', '^@pdfme/generator$': '/scripts/__mocks__/@pdfme/generator.ts', + '\\.module\\.css$': 'identity-obj-proxy', + '\\.(css|less|scss|sass)$': '/__mocks__/styleMock.ts', }, moduleFileExtensions: [ 'web.js', diff --git a/package-lock.json b/package-lock.json index 2404c03835..f07c9e0e22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11375,6 +11375,7 @@ "resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz", "integrity": "sha512-00n6YnVHKrinT9t0d9+5yZC6UBNJANpYEQvL2LlX6Ab9lnmxzIRcEmTPuyGScvl1+jKuCICX1Z0Ab1pPKKdikA==", "dev": true, + "license": "MIT", "dependencies": { "harmony-reflect": "^1.4.6" }, From 98f7136892c7f4db886a182bc8882b16d8b89a02 Mon Sep 17 00:00:00 2001 From: rafidoth Date: Tue, 17 Dec 2024 11:16:58 +0600 Subject: [PATCH 3/3] Fixed Linting Issues in jest.config.js --- jest.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jest.config.js b/jest.config.js index e91ff820bb..a22062f3f1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,7 +10,8 @@ export default { '!**/index.{js,ts}', '!**/*.d.ts', '!src/test/**', - '!vitest.config.ts',], + '!vitest.config.ts', + ], // setupFiles: ['react-app-polyfill/jsdom'], setupFiles: ['whatwg-fetch'], setupFilesAfterEnv: ['/src/setupTests.ts'], @@ -43,7 +44,7 @@ export default { '\\.svg$': '/scripts/__mocks__/fileMock.js', '^@pdfme/generator$': '/scripts/__mocks__/@pdfme/generator.ts', '\\.module\\.css$': 'identity-obj-proxy', - '\\.(css|less|scss|sass)$': '/__mocks__/styleMock.ts', + '\\.(css|less|scss|sass)$': '/__mocks__/styleMock.ts', }, moduleFileExtensions: [ 'web.js',