Enable test cases for both apps
All checks were successful
Run Tests / test-backend (push) Successful in 40s
Run Tests / test-frontend (push) Successful in 37s

This commit is contained in:
Ichitux
2026-04-01 01:58:43 +02:00
parent b5d1cb12bf
commit 93ec8e6a6c
10 changed files with 6250 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,8 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"react": "^18.2.0",
@@ -13,7 +14,11 @@
},
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"vite": "^5.0.8"
"vite": "^5.0.8",
"vitest": "^1.6.0",
"@testing-library/react": "^14.2.0",
"@testing-library/jest-dom": "^6.4.0",
"jsdom": "^24.0.0"
}
}

16
frontend/src/App.test.jsx Normal file
View File

@@ -0,0 +1,16 @@
import { describe, it, expect } from 'vitest'
import { render, screen } from '@testing-library/react'
import App from './App.jsx'
describe('App', () => {
it('renders the app header', () => {
render(<App />)
expect(screen.getByText(/FarmaFinder/i)).toBeInTheDocument()
})
it('renders the view switcher', () => {
render(<App />)
expect(screen.getByText(/Public Search/i)).toBeInTheDocument()
expect(screen.getByText(/Admin Panel/i)).toBeInTheDocument()
})
})

View File

@@ -0,0 +1 @@
import '@testing-library/jest-dom'

11
frontend/vitest.config.js Normal file
View File

@@ -0,0 +1,11 @@
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
globals: true,
setupFiles: './src/test/setup.js',
},
})