Aventuras/docs/development/testing.md
Pento 267d15f2b4
Lore management: a session ledger, a shared chapter-read budget, and a duplicate consolidation window (#437)
- **New Features**
- Added duplicate-entity review, merge previews, and “keep separate”
decisions for characters, locations, items, and lore entries.
- Added manual lore-management controls, progress summaries, and
safeguards against concurrent runs.
  - Added shared chapter-query limits and caching.

- **Bug Fixes**
  - Prevented manual chapter creation during active background work.
  - Improved name matching, duplicate handling, and lore-field cleanup.
  - Migrated context settings while preserving existing preferences.

- **Documentation**
- Streamlined the product overview, setup instructions, development
guidance, and technology information.
2026-08-12 15:32:41 +02:00

15 lines
932 B
Markdown

# Testing
Vitest (`vitest.config.ts`), covering targeted units under `src/lib/` — not a full-coverage suite. Run
with `npm test`.
**Rune modules cannot be imported by tests.** `vitest.config.ts` deliberately omits the SvelteKit plugin
to keep the suite fast and stable, so any `*.svelte.ts` file fails at import with `$state is not defined`.
Services reach the stores through `vi.mock('$lib/stores/…')`; logic that needs testing on its own is
extracted into a plain `.ts` module instead (`settingsMigrations.ts`, `advancedPanelView.ts`,
`stickiness.ts`, `recentTail.ts` are all this pattern). Those modules are production code with real
callers, not test scaffolding.
There is also no DOM environment (`environment: 'node'`), so components are not rendered by any test. A
Svelte-level mistake — a `bind:` to an undefined value, for instance — passes `check`, `lint` and the
whole suite, and only fails when the app runs.