Skip to content

Commit 728a257

Browse files
fix: unit tests
1 parent 25a554f commit 728a257

File tree

7 files changed

+20
-3
lines changed

7 files changed

+20
-3
lines changed

libs/frontend/infra/mobx/store/src/stores/test.store.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ export const createTestStore = () => {
9999

100100
const domainStore = createDomainStore(userDto, preferenceDto)
101101

102-
const applicationStore = createApplicationStore({
103-
pathParams: {},
104-
})
102+
const applicationStore = createApplicationStore(
103+
{ pathParams: {} },
104+
domainStore,
105+
)
105106

106107
@model('@codelab/TestRootStore')
107108
class TestRootStore

libs/frontend/presentation/components/interface-form/jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ export default {
3232
},
3333
],
3434
],
35+
setupFilesAfterEnv: ['./jest.mocks.ts'],
3536
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// mock server modules that are not supposed to be used in client env
2+
jest.mock('@codelab/shared/infra/fetch', () => ({
3+
fetchWithAuth: () => null,
4+
}))

libs/frontend/presentation/components/interface-form/tsconfig.spec.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"types": ["jest", "node", "@testing-library/jest-dom"]
77
},
88
"include": [
9+
"jest.mocks.ts",
910
"jest.config.ts",
1011
"src/**/*.test.ts",
1112
"src/**/*.spec.ts",

libs/frontend/test/application/jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ export default {
3131
},
3232
],
3333
],
34+
setupFilesAfterEnv: ['./jest.mocks.ts'],
3435
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// mock server modules that are not supposed to be used in client env
2+
jest.mock('@codelab/shared/infra/fetch', () => ({
3+
fetchWithAuth: () => null,
4+
}))
5+
// mock hooks that are not supported in jsdom env
6+
jest.mock('next/navigation', () => ({
7+
useParams: jest.fn().mockReturnValue({}),
8+
}))

libs/frontend/test/application/tsconfig.spec.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"types": ["jest", "node", "@testing-library/jest-dom"]
66
},
77
"include": [
8+
"jest.mocks.ts",
89
"vite.config.ts",
910
"src/**/*.test.ts",
1011
"src/**/*.spec.ts",

0 commit comments

Comments
 (0)