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
Showing
9 changed files
with
10,675 additions
and
6,130 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import userEvent from '@testing-library/user-event'; | ||
import Home from '@/pages/index' | ||
|
||
describe('Home', () => { | ||
it('renders a heading', () => { | ||
it('renders a tooltip', async () => { | ||
render(<Home />) | ||
|
||
const heading = screen.getByRole('heading', { | ||
name: /welcome to next\.js!/i, | ||
}) | ||
const trigger = screen.getByText('Nested Content'); | ||
|
||
expect(heading).toBeInTheDocument() | ||
expect(screen.queryByText('Tooltip Content')).not.toBeInTheDocument(); | ||
|
||
await userEvent.hover(trigger); | ||
|
||
expect(screen.getByText('Tooltip Content')).toBeInTheDocument(); | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,22 @@ | ||
const nextJest = require('next/jest') | ||
const nextJest = require("next/jest"); | ||
|
||
const createJestConfig = nextJest({ | ||
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment | ||
dir: './', | ||
}) | ||
dir: "./", | ||
}); | ||
|
||
// Add any custom config to be passed to Jest | ||
const customJestConfig = { | ||
testPathIgnorePatterns: ["<rootDir>/.next/", "<rootDir>/node_modules/"], | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
modulePaths: ["<rootDir>"], | ||
moduleNameMapper: { | ||
// Handle module aliases (this will be automatically configured for you soon) | ||
'^@/components/(.*)$': '<rootDir>/components/$1', | ||
"^@/components/(.*)$": "<rootDir>/components/$1", | ||
|
||
'^@/pages/(.*)$': '<rootDir>/pages/$1', | ||
"^@/pages/(.*)$": "<rootDir>/pages/$1", | ||
}, | ||
testEnvironment: 'jest-environment-jsdom', | ||
} | ||
testEnvironment: "jest-environment-jsdom", | ||
}; | ||
|
||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async | ||
module.exports = createJestConfig(customJestConfig) | ||
module.exports = createJestConfig(customJestConfig); |
Oops, something went wrong.