[Feature] Add test framework and write tests #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The repository has zero test files. No test framework (Jest, Vitest, etc.) is configured in any
package.json. The frontendtsconfig.jsonexcludes**/*.test.tsx, suggesting test file patterns were anticipated but never implemented.Proposed fix
vitest(pairs well with Vite) orjestjestorvitestwithtsxpackage.json:userService.ts(auth, password hashing),characterService.ts(CRUD, search),database.tsquery translation (SQLite dialect)authStore.ts(login/logout state),characterStore.ts(fetch/create/update),DiceRollercomponentsPriority: Medium
Labels: feature, testing, backend, frontend
Status update after review: vitest is now configured in both backend/package.json (
npm test→vitest run) and frontend/package.json, but there are zero test files in either package (no__tests__dirs, no .test. files). Framework step done; actual tests still needed. Highest-value first targets: characterService.createCharacter (skills/equipment matching), campaignService authorization helpers (isCampaignMember/isCampaignGM), auth middleware.Automated triage (openclaw monitor):
Diagnosis
package.json(frontend or backend)frontend/tsconfig.jsonexcluding**/*.test.tsxuserService.ts,characterService.ts) and frontend stores (authStore.ts,characterStore.ts) lack test coverage.forgejo/workflows/ci.ymlexists but likely doesn't run tests)Possible fix
Backend (Node.js/Express):
backend/jest.config.jswith TypeScript supportjest @types/jest ts-jest @jest/globalsbackend/package.json:backend/src/services/userService.ts(auth, password hashing)backend/src/services/characterService.ts(CRUD, search)backend/src/config/database.ts(query translation)Frontend (React/Vite):
frontend/vitest.config.tswith React support@testing-library/react @testing-library/jest-dom vitest jsdomfrontend/package.json:frontend/src/store/authStore.ts(login/logout state)frontend/src/store/characterStore.ts(fetch/create/update)Root:
Add test scripts to root
package.jsonto run both:Notes
vitestfor both orjestfor backend?.forgejo/workflows/ci.yml