We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b86381 commit 312b7d8Copy full SHA for 312b7d8
frontend/src/components/__tests__/Dashboard.test.tsx
@@ -0,0 +1,19 @@
1
+import { vi } from 'vitest'
2
+import { render, screen } from '@testing-library/react'
3
+import Dashboard from '@/components/Dashboard'
4
+
5
+vi.mock('@tanstack/react-router', () => ({
6
+ useNavigate: vi.fn(),
7
+}))
8
9
+describe('Dashboard', () => {
10
+ test('renders a heading with the correct text', () => {
11
+ const navigate = vi.fn()
12
+ const useNavigateMock = vi.fn(() => navigate)
13
+ vi.doMock('@tanstack/react-router', () => ({
14
+ useNavigate: useNavigateMock,
15
+ }))
16
+ render(<Dashboard />)
17
+ expect(screen.getByText(/Employee ID/i)).toBeInTheDocument()
18
+ })
19
+})
0 commit comments