test: Vitest setup + unit tests for API client, hooks, services + staff E2E

- Vitest + React Testing Library + MSW setup
- API client: 11 unit tests (fetch, errors, auth header, download, network failure)
- Service hooks: 26 tests across members, distributions, stock, dashboard, staff
- Custom hooks: 5 debounce tests (timer behavior, reset, custom delay)
- Components: 5 tests (offline banner, error boundary with retry)
- E2E: staff management page interactions
- npm scripts: test, test:run, test:coverage
This commit is contained in:
Patrick Plate
2026-06-12 20:50:45 +02:00
parent d1487539b6
commit 4d64576f22
17 changed files with 2819 additions and 1 deletions
+10 -1
View File
@@ -14,6 +14,9 @@
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier --ignore-path .gitignore --write .",
"test": "vitest",
"test:run": "vitest run",
"test:coverage": "vitest run --coverage",
"test:e2e": "playwright test e2e/full-check.spec.ts e2e/functional-flows.spec.ts",
"test:system": "playwright test e2e/system-test.spec.ts",
"test:all": "playwright test"
@@ -72,21 +75,27 @@
"@playwright/test": "^1.60.0",
"@tailwindcss/postcss": "4.0.17",
"@tailwindcss/typography": "0.5.15",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/eslint__eslintrc": "2.1.2",
"@types/node": "20",
"@types/react": "19.0.12",
"@types/react-dom": "19.0.4",
"@vitejs/plugin-react": "^6.0.2",
"eslint": "9.18.0",
"eslint-config-next": "15.5.18",
"eslint-config-prettier": "10.1.1",
"eslint-plugin-prettier": "5.2.3",
"jsdom": "^29.1.1",
"msw": "^2.14.6",
"playwright": "^1.60.0",
"postcss": "8",
"prettier": "3.5.3",
"prettier-plugin-tailwindcss": "0.6.11",
"tailwindcss": "4.1.3",
"tw-animate-css": "1.2.5",
"typescript": "5"
"typescript": "5",
"vitest": "^4.1.8"
},
"overrides": {
"@types/react": "19.0.12",