Ny automatisk testsvit för träningslogiken.

This commit is contained in:
larssand
2026-08-24 18:35:22 +02:00
parent 8b7153bf6a
commit e22077b4d5
5 changed files with 168 additions and 2 deletions

View File

@@ -2028,11 +2028,30 @@ Mitigation:
- treat backend hydration and local dirty flags as runtime concerns
- inspect `src/runtime_services.js` together with the affected save path
## 18. Recommended Future Additions
## 18. Automated Regression Tests
Run:
```bash
npm test
```
`tests/training_logic.test.js` covers:
- training-state normalization and duplicate rejection
- invalid, anonymous, and sub-500 ms lap exclusion
- replacement of current-session ledger rows after corrections
- retention of archived/deleted-session history
- per-driver isolation and day/session aggregation
- recommendation branch selection
- custom goal and automatic milestone progress
The suite uses Node's built-in `node:test` runner and does not add a test-framework dependency. Windows PowerShell/CMD can run the same suite with `npm.cmd test`.
## 19. Recommended Future Additions
If the project grows further, the next useful additions to this document are:
- exact `resultsBySession` competitor row schema
- exact `settings` schema snapshot
- SQLite table contract section
- controller-to-view ID map for critical forms/buttons
- test checklist per module
- additional test checklists for race generation, timing, judging, and persistence modules