add unit test suite: 80 tests across utils, api, auth, clients, events, emails

- Vitest + React Testing Library + jsdom setup
- utils.test.ts: cn, formatDate, formatFullDate, getInitials, getRelativeTime, getDaysUntil
- api.test.ts: token management, auth, CRUD for clients/events/emails, admin, error handling
- auth.test.ts: login, logout, checkSession, setUser
- clients.test.ts: fetch, create, update, delete, markContacted, filters
- events.test.ts: fetch, create, update, delete, syncAll
- emails.test.ts: fetch, generate, update, send, delete
This commit is contained in:
2026-01-28 22:12:38 +00:00
parent c838a714d2
commit b6de50ba5e
10 changed files with 2063 additions and 3 deletions

View File

@@ -7,7 +7,9 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"clsx": "^2.1.1",
@@ -21,6 +23,9 @@
"devDependencies": {
"@eslint/js": "^9.39.1",
"@tailwindcss/vite": "^4.1.18",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^24.10.1",
"@types/react": "^19.2.5",
"@types/react-dom": "^19.2.3",
@@ -29,9 +34,11 @@
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
"jsdom": "^27.4.0",
"tailwindcss": "^4.1.18",
"typescript": "~5.9.3",
"typescript-eslint": "^8.46.4",
"vite": "^7.2.4"
"vite": "^7.2.4",
"vitest": "^4.0.18"
}
}