-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**QA Steps:** 1. Create a scaf project 2. Cd into frontend folder 3. run `npm run test` and expect to see success (make sure `npm i` is run to install packages) --------- Co-authored-by: sedatbasar <[email protected]>
- Loading branch information
1 parent
2fa7276
commit 4a2a5b2
Showing
11 changed files
with
160 additions
and
88 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
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
23 changes: 19 additions & 4 deletions
23
{{cookiecutter.project_slug}}/frontend/__tests__/about.test.tsx
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,8 +1,23 @@ | ||
import { expect, test } from 'vitest' | ||
import { render, screen } from '@testing-library/react' | ||
import AboutPage from '../pages/about' | ||
import { GET_ME } from '@/pages' | ||
import { render, screen } from '@/utils/test-utils' | ||
|
||
test('AboutPage', () => { | ||
render(<AboutPage />) | ||
expect(screen.getByRole('heading', { level: 1, name: 'About Page' })).toBeDefined() | ||
const mocks = [ | ||
{ | ||
request: { | ||
query: GET_ME | ||
}, | ||
result: { | ||
data: { | ||
me: { id: '1', name: 'John Doe' } | ||
} | ||
} | ||
} | ||
] | ||
|
||
test('AboutPage', async () => { | ||
render(<AboutPage />, { mocks }) | ||
expect(await screen.findByRole('heading', { level: 1, name: 'About Page' })).toBeInTheDocument() | ||
expect(await screen.findByText('John Doe')).toBeInTheDocument() | ||
}) |
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.