Add persistence and SQLite integration tests

This commit is contained in:
larssand
2026-08-24 19:08:21 +02:00
parent 0ca1679e2a
commit 5a6e51c51b
6 changed files with 449 additions and 3 deletions

View File

@@ -2090,6 +2090,21 @@ npm test
- safe handling when no counted lap exists
- competitor and judging-log filters
`tests/runtime_persistence.test.js` covers:
- persisted entity/settings normalization during backend hydration
- invalid-theme fallback and retention of local setting defaults
- hydration success/error behavior and no-write-back handling
- full-state POST payloads and synced-version advancement
- dirty-state protection when newer local edits occur during a request
- failed-sync behavior without false version advancement
`tests/server_persistence.integration.test.js` starts an isolated backend with a temporary SQLite data directory and covers:
- health/database path reporting
- empty-state response and full app-state round-trip
- passing persistence and session-scoped passing queries
- atomic hot-update of `resultsBySession[sessionId]` for overlay hydration
- preservation of the rest of the stored state during a passing hot-update
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
@@ -2099,4 +2114,4 @@ If the project grows further, the next useful additions to this document are:
- exact `settings` schema snapshot
- SQLite table contract section
- controller-to-view ID map for critical forms/buttons
- additional test checklists for persistence modules
- browser-level smoke tests for critical create/edit workflows