Single source of truth: combat logic, storage parity, slot ordering #3
Generated
+26
-1158
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -8,7 +8,6 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@testing-library/jest-dom": "^5.17.0",
|
"@testing-library/jest-dom": "^5.17.0",
|
||||||
"@testing-library/react": "^13.4.0",
|
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.19",
|
||||||
"firebase": "^10.12.2",
|
"firebase": "^10.12.2",
|
||||||
@@ -47,5 +46,8 @@
|
|||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@testing-library/react": "^14.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,25 @@ 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
|
// notify exact doc path subscribers (wrapped in act for test isolation)
|
||||||
if (state.subscribers.has(path)) state.subscribers.get(path).forEach(cb => cb());
|
if (state.subscribers.has(path)) state.subscribers.get(path).forEach(cb => {
|
||||||
|
try {
|
||||||
|
const { act } = require('react');
|
||||||
|
act(() => cb());
|
||||||
|
} catch {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
});
|
||||||
// notify parent collection subscribers
|
// notify parent collection subscribers
|
||||||
const parent = path.split('/').slice(0, -1).join('/');
|
const parent = path.split('/').slice(0, -1).join('/');
|
||||||
if (parent && state.subscribers.has(parent)) state.subscribers.get(parent).forEach(cb => cb());
|
if (parent && state.subscribers.has(parent)) state.subscribers.get(parent).forEach(cb => {
|
||||||
|
try {
|
||||||
|
const { act } = require('react');
|
||||||
|
act(() => cb());
|
||||||
|
} catch {
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
nextId() { state.counter += 1; return String(state.counter).padStart(3, '0'); },
|
nextId() { state.counter += 1; return String(state.counter).padStart(3, '0'); },
|
||||||
_state: state,
|
_state: state,
|
||||||
|
|||||||
Reference in New Issue
Block a user