Tests of components
-
[E] Contract tests per component (#114): each component under
src/core/components/has its test next to it (src/core/components/<component>.test.ts), which runs for every entry that has the component, read from the generated index; a new entry needs no new test code. A property test (src/core/production.test.ts) keepsprod()bit-identical to its form before #114 (owner, 2026-11-13), andsrc/core/battle-reference.test.tskeepsbattle()bit-identical to its form before the combat components (#114, second pull request), andsrc/core/flight-reference.test.tskeeps speed, fuel and cargo of a fleet bit-identical to their form before the flight component (#114, third pull request), andsrc/core/limits-reference.test.tskeeps the room for units and the energy need and shortage bit-identical to their form before the limits group (#114, fourth pull request). For the generic events of #115,src/core/settle-reference.test.tskeepssettle(),accrue()andproduction()bit-identical to their form before (300 generated cases, fast-check seed 115) and checks settling in steps within the tolerance of #47, stocks ≥ 0 and the storage limit;src/server/game/research-reference.test.tskeeps the planets that a new research settles, on two databases in memory. See Design patterns, section 12. -
[E] The rows of the resources page (#114,
ProducerTable): the property testsrc/core/producer-rows.test.tschecks that the rows ofproducerRows()add up toprod()of the planet as it runs, bit for bit whereprod()adds in the same order (owner, 2026-11-14). -
[E] Svelte components and state modules in Vitest (#118): the Vitest configuration loads the Svelte plugin of the build (
@sveltejs/vite-plugin-svelte), so tests import.svelteand.svelte.tsfiles; a component test renders withrender()ofsvelte/server(no DOM, no new dependency) and reads the markup as text (src/client/views/catalog-list.test.ts: every entry of a kind gets one row). The state modulesrc/client/logic/state.svelte.tslies in the measuredsrc/client/logic/and is mutated like the other logic; Stryker instruments it without breaking the runes (measured 2026-11-14). -
[E] No keyed list of a view gets the same key twice (#369, owner, 2026-11-22 and 2026-11-24): Svelte throws
each_key_duplicateand the view stops drawing, as the fleet page did on the live server (#362). [V] A server render in Vitest does not throw on a duplicate key and the project has no DOM test environment, so the check reads the sources:src/client/views/keyed-lists.test.tslists every{#each … (key)}ofsrc/clientby component and key with the reason the key cannot repeat (the loop index, a constant or a registry, one source with a unique key, or more than one source with the unit test that proves the keys unique). A new list fails until it is judged, a list without a key fails, and a judged list that is gone fails. The audit of 2026-11-24 judged 136 lists: 62 constant, 33 one source, 33 index, 6 merged with a dedupe, and 2 that could repeat, the cards „Achtung“ and „Bereit“ of the overview on a phone, keyed by their text (two attacks of one player from one place; a planet named like its moon). They are keyed by the fleet, the place or the kind of the line now, with a unit test each.