Skip to content

Commit 36c99c9

Browse files
committed
Jest config and refactored autocompletedirectionshandler
1 parent 9dd9269 commit 36c99c9

9 files changed

+270780
-272
lines changed

jest.config.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// jest.config.js
2+
const nextJest = require('next/jest');
3+
4+
const createJestConfig = nextJest({
5+
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
6+
dir: './',
7+
});
8+
9+
// Add any custom config to be passed to Jest
10+
/** @type {import('jest').Config} */
11+
const customJestConfig = {
12+
// Add more setup options before each test is run
13+
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
14+
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
15+
moduleDirectories: ['node_modules', '<rootDir>/'],
16+
testEnvironment: 'jest-environment-jsdom',
17+
};
18+
19+
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
20+
module.exports = createJestConfig(customJestConfig);

package.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"devInspect": "NODE_OPTIONS='--inspect' next dev",
88
"build": "next build",
99
"start": "next start",
10-
"lint": "next lint"
10+
"lint": "next lint",
11+
"test": "jest --watch"
1112
},
1213
"dependencies": {
1314
"@googlemaps/js-api-loader": "^1.14.3",
@@ -48,14 +49,22 @@
4849
"yup": "^0.32.11"
4950
},
5051
"devDependencies": {
52+
"@googlemaps/jest-mocks": "^2.7.5",
53+
"@jest/globals": "^29.3.1",
5154
"@playwright/test": "^1.27.1",
55+
"@testing-library/jest-dom": "^5.16.5",
56+
"@testing-library/react": "^13.4.0",
57+
"@types/jest": "^29.2.3",
5258
"@types/node": "18.0.0",
5359
"@types/react": "18.0.14",
5460
"@types/react-dom": "18.0.5",
5561
"@types/uuid": "^8.3.4",
5662
"eslint": "8.18.0",
5763
"eslint-config-next": "13.0.1",
5864
"flowbite-typography": "^1.0.3",
65+
"jest": "^29.3.1",
66+
"jest-environment-jsdom": "^29.3.1",
67+
"ts-jest": "^29.0.3",
5968
"typescript": "4.7.4"
6069
}
6170
}

0 commit comments

Comments
 (0)