Fixed tests
This commit is contained in:
Binary file not shown.
Generated
+1167
-1
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,8 @@
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"test": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.2.0",
|
||||
@@ -15,6 +16,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
@@ -22,6 +25,8 @@
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"globals": "^16.5.0",
|
||||
"vite": "^7.3.1"
|
||||
"jsdom": "^28.0.0",
|
||||
"vite": "^7.3.1",
|
||||
"vitest": "^4.0.18"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// frontend/src/App.jsx
|
||||
import { useState } from 'react'
|
||||
import reactLogo from './assets/react.svg'
|
||||
import viteLogo from '/vite.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// frontend/src/App.test.jsx
|
||||
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { expect, test } from 'vitest';
|
||||
import App from './App';
|
||||
|
||||
test('renders the Vite and React logos', () => {
|
||||
// 1. Render the component
|
||||
render(<App />);
|
||||
|
||||
// 2. Search for elements
|
||||
const heading = screen.getByText(/Vite \+ React/i);
|
||||
|
||||
// 3. Assert (the "expect" part)
|
||||
expect(heading).toBeInTheDocument();
|
||||
});
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -1,7 +1,21 @@
|
||||
// frontend/vite.config.js
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
setupFiles: './vitest.setup.js',
|
||||
css: true,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
// This ensures that /vite.svg points to the public folder correctly
|
||||
"/": path.resolve(__dirname, "./public"),
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
// frontend/vitest.setup.js
|
||||
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
Reference in New Issue
Block a user