From a406f5962e67be93462168c616b52b0ccad1706a Mon Sep 17 00:00:00 2001 From: mesalogo Date: Thu, 8 Oct 2026 13:00:41 +0800 Subject: [PATCH] test: restore cancellation and drain coverage --- src/main/desktop-storage-electron-fixture.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/desktop-storage-electron-fixture.ts b/src/main/desktop-storage-electron-fixture.ts index cc122932..6daafdfa 100644 --- a/src/main/desktop-storage-electron-fixture.ts +++ b/src/main/desktop-storage-electron-fixture.ts @@ -232,8 +232,11 @@ async function run(): Promise { const cancelled = new DesktopStorageClient(options) await cancelled.ready const cancelledChange = largeChange('Cancelled write') - await cancelled.call('assistant', 'saveLocalConversations', [cancelledChange]) - assert.ok((await cancelled.call('assistant', 'searchConversations', ['Cancelled write'])).length > 0) + const cancellation = new AbortController() + const cancelledRequest = cancelled.call('assistant', 'saveLocalConversations', [cancelledChange], { signal: cancellation.signal }) + cancellation.abort() + await assert.rejects(cancelledRequest, { name: 'AbortError' }) + assert.deepEqual(await cancelled.call('assistant', 'searchConversations', ['Cancelled write']), []) await cancelled.close() const faulted = new DesktopStorageClient(options) @@ -250,8 +253,9 @@ async function run(): Promise { assert.deepEqual(await faulted.call('assistant', 'searchConversations', ['Failed post']), []) const complete = largeChange('Drain writes') const writing = faulted.call('assistant', 'saveLocalConversations', [complete]) + const draining = faulted.close() await writing - await faulted.close() + await draining const drained = new DesktopStorageClient(options) await drained.ready assert.equal((await drained.call('assistant', 'getConversation', [complete[0]!.header.id])).messages[0]!.content, complete[0]!.messages[0]!.content)