Single source of truth: combat logic, storage parity, slot ordering #3
@@ -5,10 +5,14 @@ REWORK_PLAN.md.
|
|||||||
|
|
||||||
## Feature backlog
|
## Feature backlog
|
||||||
|
|
||||||
### CRITICAL BUG - storage
|
TODO: FIX: test for warnings. any warnings in tests, or compile or runtime == failure. like perl and php used to ahve. warning == error. we should lways solve them
|
||||||
- docker for sql is not using persistant storage...
|
|
||||||
|
TODO: make tests have integrated timeout - even 60s is probabvly too long, should not take long.
|
||||||
|
|
||||||
|
TODO: combat.scenario doesnt do 100 rounds it does 100 turns. recover from kill-shared stash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### feat - campaign section rollup
|
|
||||||
|
|
||||||
### feat - add all characters to participants list
|
### feat - add all characters to participants list
|
||||||
|
|
||||||
|
|||||||
Generated
+1148
-2
File diff suppressed because it is too large
Load Diff
@@ -38,11 +38,16 @@ export const MOCK_DB = {
|
|||||||
return () => state.subscribers.get(path)?.delete(cb);
|
return () => state.subscribers.get(path)?.delete(cb);
|
||||||
},
|
},
|
||||||
_notify(path) {
|
_notify(path) {
|
||||||
// notify exact doc path subscribers (wrapped in act for test isolation)
|
// notify exact doc path subscribers (wrapped in act for test isolation).
|
||||||
|
// Set flag true around cb: RTL asyncWrapper (waitFor) flips it false
|
||||||
|
// during poll, making raw react act() warn 'not configured'.
|
||||||
if (state.subscribers.has(path)) state.subscribers.get(path).forEach(cb => {
|
if (state.subscribers.has(path)) state.subscribers.get(path).forEach(cb => {
|
||||||
try {
|
try {
|
||||||
const { act } = require('react');
|
const { act } = require('react');
|
||||||
|
const prev = globalThis.IS_REACT_ACT_ENVIRONMENT;
|
||||||
|
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
||||||
act(() => cb());
|
act(() => cb());
|
||||||
|
globalThis.IS_REACT_ACT_ENVIRONMENT = prev;
|
||||||
} catch {
|
} catch {
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
@@ -52,7 +57,10 @@ export const MOCK_DB = {
|
|||||||
if (parent && state.subscribers.has(parent)) state.subscribers.get(parent).forEach(cb => {
|
if (parent && state.subscribers.has(parent)) state.subscribers.get(parent).forEach(cb => {
|
||||||
try {
|
try {
|
||||||
const { act } = require('react');
|
const { act } = require('react');
|
||||||
|
const prev = globalThis.IS_REACT_ACT_ENVIRONMENT;
|
||||||
|
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
||||||
act(() => cb());
|
act(() => cb());
|
||||||
|
globalThis.IS_REACT_ACT_ENVIRONMENT = prev;
|
||||||
} catch {
|
} catch {
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
// jest setup: RTL jest-dom + mock DB reset per test.
|
// jest setup: RTL jest-dom + mock DB reset per test.
|
||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
|
|
||||||
|
// RTL v14: tell React this is an act environment. Without it every
|
||||||
|
// async update warns "current testing environment is not configured to
|
||||||
|
// support act(...)". RTL reads getGlobalThis(), so set on globalThis.
|
||||||
|
// Must be set before any component renders.
|
||||||
|
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
||||||
|
|
||||||
|
// WARNING = FAILURE. Fail test on any console.error/warn (React act warnings,
|
||||||
|
// deprecations, prop errors). App code's own error logs allowed only inside
|
||||||
|
// try/catch failure paths — those tests should assert the error was handled,
|
||||||
|
// not silently log it. Override the spies to throw.
|
||||||
|
const originalError = console.error;
|
||||||
|
const originalWarn = console.warn;
|
||||||
|
console.error = (...args) => {
|
||||||
|
originalError(...args);
|
||||||
|
throw new Error(`console.error in test: ${args.map(String).join(' ').slice(0, 500)}`);
|
||||||
|
};
|
||||||
|
console.warn = (...args) => {
|
||||||
|
originalWarn(...args);
|
||||||
|
throw new Error(`console.warn in test: ${args.map(String).join(' ').slice(0, 500)}`);
|
||||||
|
};
|
||||||
import { resetMockDb } from './__mocks__/firebase/_mock-db';
|
import { resetMockDb } from './__mocks__/firebase/_mock-db';
|
||||||
|
|
||||||
// polyfill crypto.randomUUID for jsdom (used by generateId in App.js).
|
// polyfill crypto.randomUUID for jsdom (used by generateId in App.js).
|
||||||
|
|||||||
Reference in New Issue
Block a user