-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e47663
commit e1465a0
Showing
115 changed files
with
11,100 additions
and
10,344 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,4 @@ | ||
{ | ||
"presets": ["next/babel", "@babel/preset-typescript"], | ||
"plugins": [] | ||
} |
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
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
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,33 @@ | ||
import type { JestConfigWithTsJest } from "ts-jest"; | ||
import nextJest from "next/jest.js"; | ||
|
||
const createJestConfig = nextJest({ | ||
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment | ||
dir: "./", | ||
}); | ||
|
||
// Add any custom config to be passed to Jest | ||
/** @type {import('jest').Config} */ | ||
const config: JestConfigWithTsJest = { | ||
// Add more setup options before each test is run | ||
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
|
||
moduleNameMapper: { | ||
// Handle module aliases | ||
"^@/(.*)$": "<rootDir>/$1", | ||
"^@/components/(.*)$": "<rootDir>/src/components/$1", | ||
"^@/context/(.*)$": "<rootDir>/src/context/$1", | ||
"^@/hooks/(.*)$": "<rootDir>/src/hooks/$1", | ||
"^@/lib/(.*)$": "<rootDir>/src/lib/$1", | ||
"^@/mocks/(.*)$": "<rootDir>/src/mocks/$1", | ||
"^@/pages/(.*)$": "<rootDir>/src/pages/$1", | ||
"^@/styles/(.*)$": "<rootDir>/src/styles/$1", | ||
"^@/types/(.*)$": "<rootDir>/src/types/$1", | ||
}, | ||
preset: "ts-jest", | ||
testEnvironment: "jest-environment-jsdom", | ||
}; | ||
|
||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async | ||
// @ts-ignore | ||
export default createJestConfig(config); |
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,26 @@ | ||
// Add any custom config to be passed to Jest | ||
/** @type {import('jest').Config} */ | ||
const config = { | ||
// Add more setup options before each test is run | ||
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"], | ||
|
||
moduleNameMapper: { | ||
// Handle module aliases | ||
"^@/(.*)$": "<rootDir>/$1", | ||
"^@components/(.*)$": "<rootDir>/src/components/$1", | ||
"^@config/(.*)$": "<rootDir>/config/$1", | ||
"^@context/(.*)$": "<rootDir>/src/context/$1", | ||
"^@hooks/(.*)$": "<rootDir>/src/hooks/$1", | ||
"^@lib/(.*)$": "<rootDir>/src/lib/$1", | ||
"^@mocks/(.*)$": "<rootDir>/src/mocks/$1", | ||
"^@pages/(.*)$": "<rootDir>/src/pages/$1", | ||
"^@styles/(.*)$": "<rootDir>/src/styles/$1", | ||
"^@types/(.*)$": "<rootDir>/src/types/$1", | ||
|
||
// Mock next/font | ||
"next/font": "<rootDir>/src/mocks/next-font.ts", | ||
}, | ||
testEnvironment: "jest-environment-jsdom", | ||
}; | ||
|
||
export default config; |
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,13 @@ | ||
import "@testing-library/jest-dom"; | ||
|
||
// IntersectionObserver isn't available in test environment | ||
const mockIntersectionObserver = jest.fn(); | ||
mockIntersectionObserver.mockReturnValue({ | ||
observe: () => null, | ||
unobserve: () => null, | ||
disconnect: () => null, | ||
}); | ||
window.IntersectionObserver = mockIntersectionObserver; | ||
|
||
// Mock next/router | ||
jest.mock("next/router", () => require("next-router-mock")); |
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
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
Oops, something went wrong.