forked from uc-cdis/commons-frontend-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VADC-1644: add test support for RTKQuery (#8)
* add cohortAp and hooks * add teamProjectHooks.ts * setup jest test storybook with rtkQuery hooks * add test support for RTKQ add teamProjectHooks.test * clean up test * clean up test * add sharp * add sharp * update to 0.10.79 * revert CohortDefinitions refactor test-utils * add error to useProjectHooks * remove hook story * remove cohortApi to keep PR smaller
- Loading branch information
1 parent
ca96c53
commit 4d23c88
Showing
10 changed files
with
762 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GEN3_COMMONS_NAME=gen3 | ||
NEXT_PUBLIC_GEN3_API=https://localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* global jest */ | ||
|
||
const mockStorage = { | ||
getItem: jest.fn((_key) => Promise.resolve(null)), | ||
setItem: jest.fn((_key, item) => Promise.resolve(item)), | ||
removeItem: jest.fn((_key) => Promise.resolve()), | ||
}; | ||
|
||
const createWebStorage = (_arg) => mockStorage; | ||
module.exports = createWebStorage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { JestConfigWithTsJest } from 'ts-jest'; | ||
|
||
const jestConfig: JestConfigWithTsJest = { | ||
preset: 'ts-jest', | ||
rootDir: __dirname, | ||
roots: ['<rootDir>/src'], | ||
moduleNameMapper: { | ||
'^@/components(.*)$': '<rootDir>/src/components/$1', | ||
'^@/lib/(.*)$': '<rootDir>/src/lib/$1', | ||
'^redux-persist/lib/storage/createWebStorage$': | ||
'<rootDir>/__mocks__/createWebStorageMock.js', | ||
}, | ||
testEnvironment: 'jest-fixed-jsdom', | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'], | ||
transform: { | ||
'^.+\\.(ts|tsx)?$': [ | ||
'ts-jest', | ||
{ | ||
isolatedModules: true, | ||
tsconfig: 'tsconfig.test.json', | ||
}, | ||
], | ||
'node_modules/(flat|jsonpath-plus|uuid)/.+\\.(j|t)sx?$': ['ts-jest', {}], | ||
}, | ||
transformIgnorePatterns: ['/node_modules/(?!(flat|jsonpath-plus|uuid))'], | ||
modulePaths: ['<rootDir>'], | ||
globals: { | ||
fetch: global.fetch, | ||
}, | ||
}; | ||
|
||
export default jestConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import '@testing-library/jest-dom'; | ||
import { loadEnvConfig } from '@next/env'; | ||
|
||
loadEnvConfig(__dirname, true, { info: () => null, error: console.error }); |
Oops, something went wrong.