test(sync): pin the write-back of remapped outbox entries

Refs #165

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-11-03 21:12:51 -05:00
commit 532b628887

View file

@ -269,6 +269,8 @@ check('writes made during the first sync are queued and follow the server Inbox
const remap = merge.indexOf('await db.update(tasks).set({ listId: serverInboxId }).where(eq(tasks.listId, INBOX_ID));');
const pending = merge.indexOf('remapInboxEntry(entry, serverInboxId)');
assert.ok(remap >= 0 && pending > remap, 'the pending entries follow the server Inbox after the local remap');
assert.match(merge, /const remapped = remapInboxEntry\(entry, serverInboxId\);\s*if \(remapped\) await db\.update\(syncOutbox\)\.set\(remapped\)\.where\(eq\(syncOutbox\.id, entry\.id\)\);/, 'the remapped entry is written back');
assert.match(merge, /const pending = await db\.select\(\)\.from\(syncOutbox\)\.where\(isNull\(syncOutbox\.syncedAt\)\);\s*for \(const entry of pending\) \{/, 'every unsent entry is remapped');
});
// No merge across accounts (#165). firstSyncChoice and canSync are executed