fixed tests
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Urban Modig
2025-10-09 19:10:48 +02:00
parent 13161fb56c
commit fa613adde5
4 changed files with 26 additions and 4 deletions

View File

@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react'
import { DashboardPage } from '../DashboardPage'
import { expect, test } from 'vitest'
test('renders dashboard headline', () => {
render(<DashboardPage />)
expect(screen.getByText(/Välkommen till HemHub/i)).toBeInTheDocument()
})

View File

@ -27,5 +27,12 @@
"baseUrl": ".", "baseUrl": ".",
"paths": { "@/*": ["src/*"] } "paths": { "@/*": ["src/*"] }
}, },
"include": ["src"] "include": ["src/**/*"],
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.tsx",
"src/**/*.spec.ts",
"src/**/*.spec.tsx",
"src/**/__tests__/**"
],
} }

View File

@ -1,7 +1,12 @@
import { defineConfig } from 'vitest/config' import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths' import tsconfigPaths from 'vite-tsconfig-paths'
export default defineConfig({ export default defineConfig({
plugins: [tsconfigPaths()], plugins: [react(), tsconfigPaths()], // 👈 viktigt
test: { environment: 'jsdom', setupFiles: ['./vitest.setup.ts'] }, test: {
environment: 'jsdom',
setupFiles: ['./vitest.setup.ts'],
globals: true,
},
}) })

View File

@ -0,0 +1,2 @@
// vitest.setup.ts
import '@testing-library/jest-dom/vitest'