Skip to content

Commit 59e881e

Browse files
committed
test(chat): cover legacy no-workspaceId handoff tombstoning
1 parent 1a278fb commit 59e881e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

apps/sim/lib/core/utils/browser-storage.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ describe('MothershipHandoffStorage', () => {
5353
expect(localStorage.getItem(STORAGE_KEYS.MOTHERSHIP_HANDOFF)).toBeNull()
5454
})
5555

56+
it('tombstones a legacy entry (message + timestamp, no workspaceId) rather than firing it', () => {
57+
// The old pre-scoping format could be sitting in storage across a deploy —
58+
// it must be discarded, not attributed to the current workspace.
59+
vi.useFakeTimers()
60+
try {
61+
vi.setSystemTime(new Date('2026-01-01T00:00:00Z'))
62+
localStorage.setItem(
63+
STORAGE_KEYS.MOTHERSHIP_HANDOFF,
64+
JSON.stringify({ message: 'fix it', timestamp: Date.now() })
65+
)
66+
67+
expect(MothershipHandoffStorage.consume(WS)).toBeNull()
68+
expect(localStorage.getItem(STORAGE_KEYS.MOTHERSHIP_HANDOFF)).toBeNull()
69+
} finally {
70+
vi.useRealTimers()
71+
}
72+
})
73+
5674
it('drops and clears a handoff older than maxAge', () => {
5775
vi.useFakeTimers()
5876
try {

0 commit comments

Comments
 (0)