31 tests in test/, run in a plain Node env with a tiny localStorage shim (no jsdom — its Node-22.4 transitive-dep breakage isn't worth working around for logic tests): - type-chart: modern effectiveness, dual-type stacking, and the era rules (no Fairy pre-6, Steel resists Ghost/Dark pre-6, the Gen 1 Ghost→Psychic and Bug↔Poison quirks). - damage-calc: nature multipliers, the Gen 3+ stat formula (Garchomp reference values), STAB/effectiveness/immunity, pre/post-Gen-6 crit. - savedex: a synthetic Gen 1 SRAM (bitfields + checksum) round-trips; checksum-mismatch and size guards. - selection: normalizeSelection v2→v3 migration, per-game isolation, global favourite, stats vs statsNational. - pokedex-resolver: prettify, dex resolution against a mini snapshot. `npm test` wired into CI after format:check. Also: docker-compose host port 8080 → 4753 (README updated). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Ve7HLspzeG2xDPtJQ8vmu
16 lines
570 B
JavaScript
16 lines
570 B
JavaScript
// Minimal localStorage for the store modules (createStore persists to it).
|
|
// Enough for get/set/remove/clear; synchronous, in-memory, per test process.
|
|
if (typeof globalThis.localStorage === 'undefined') {
|
|
const store = new Map();
|
|
globalThis.localStorage = {
|
|
getItem: (k) => (store.has(k) ? store.get(k) : null),
|
|
setItem: (k, v) => void store.set(String(k), String(v)),
|
|
removeItem: (k) => void store.delete(k),
|
|
clear: () => void store.clear(),
|
|
key: (i) => [...store.keys()][i] ?? null,
|
|
get length() {
|
|
return store.size;
|
|
},
|
|
};
|
|
}
|