test: logs + deathSave characterization (6 tests)

- Logs.characterization.test.js: logAction (write + undo payload), clearLogs batch delete, undo (updateDoc encounter + mark undone), deathSave increment + isDying
- mock firestore getDocs: return .ref.path on docs (batch.delete support)
- mock addDoc: record full doc path not collection path

All write sites characterized. 56 frontend tests green.
This commit is contained in:
david raistrick
2026-06-28 19:00:08 -04:00
parent d581e60ba3
commit 35b5a1d238
2 changed files with 173 additions and 2 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ export async function deleteDoc(docRef) {
export async function addDoc(collRef, data) {
const id = `auto_${MOCK_DB.nextId()}`;
const path = `${collRef.path}/${id}`;
recordCall({ fn: 'addDoc', path: collRef.path, data: clone(data) });
recordCall({ fn: 'addDoc', path, data: clone(data) });
MOCK_DB.set(path, clone(data));
return { id, path };
}
@@ -64,7 +64,7 @@ export async function getDoc(docRef) {
export async function getDocs(collRefOrQuery) {
const collPath = collRefOrQuery.ref ? collRefOrQuery.ref.path : collRefOrQuery.path;
const docs = MOCK_DB.collection(collPath);
return { docs: docs.map(d => ({ id: d.id, data: () => d.data })) };
return { docs: docs.map(d => ({ id: d.id, data: () => d.data, ref: { path: `${collPath}/${d.id}` } })) };
}
// realtime — emit from mock DB, capture unsub