test(test-runtime): cover the archiveSession double's default and stub arms

The default arm builds the next Set outside the immer draft: reading a
Set through a draft requires the MapSet plugin, assigning a fresh Set
does not.
This commit is contained in:
imccyu
2026-07-31 03:23:26 +08:00
committed by imccyu
parent fc0042e47e
commit c00f0dccda
2 changed files with 13 additions and 2 deletions

View File

@@ -199,8 +199,11 @@ export class TestWorkspaces implements IWorkspaces {
await (stub(sessionId) as Promise<void>)
return
}
// Built outside the draft: reading a Set through an immer draft needs
// the MapSet plugin, while assigning a fresh Set does not.
const next = new Set([...this.list.getSnapshot().archivedSessionIds, sessionId])
await this.update((draft) => {
draft.archivedSessionIds = new Set([...draft.archivedSessionIds, sessionId])
draft.archivedSessionIds = next
})
}
}