From 532b628887cee71ed2cb832b04e564a2dc557605 Mon Sep 17 00:00:00 2001 From: le king fu Date: Tue, 3 Nov 2026 21:12:51 -0500 Subject: [PATCH] test(sync): pin the write-back of remapped outbox entries Refs #165 Co-Authored-By: Claude Opus 5.5 --- tests/smoke.test.cjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/smoke.test.cjs b/tests/smoke.test.cjs index 710cf84..1f6a3c9 100644 --- a/tests/smoke.test.cjs +++ b/tests/smoke.test.cjs @@ -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