Skip to content

The agent that grows with you

test(webapp): clear and read the journal through storage keys in prompt-action tests

unsupportedpastels4d8665896c32
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx
index 9f6c2221de3..511d4b4de3f 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.test.tsx
@@ -33,15 +33,15 @@ import { dropSessionState, publishSessionState } from '@/store/session-states'
import { $wakeWord, resetWakeWordState } from '@/store/wake-word'
import { actRender, Harness, type HarnessHandle, RUNTIME_SESSION_ID, sessionInfo } from './index-test-utils'
+import { clearStoredJournal, storedJournal } from './prepared-submissions-test-utils'
import { clearSingleFlightSessionResumeState } from './single-flight-resume'
import { SESSION_COMPRESS_TIMEOUT_MS } from './slash'
-// Suites in this file reuse the same stored-id constants. The module-level
-// single-flight resume map (and drift-recovery cache) would otherwise leak a
-// never-settling in-flight promise from one test into the next.
+// Suites in this file reuse the same stored-id constants. The module-level single-flight resume map
+// (and drift-recovery cache) would otherwise leak a never-settling in-flight promise from one test into the next.
beforeEach(() => {
clearSingleFlightSessionResumeState()
- Object.keys(window.localStorage).filter(key => key.startsWith('hermes.desktop.preparedSubmissions.v2:')).forEach(key => window.localStorage.removeItem(key))
+ clearStoredJournal()
// Queue mutations build on the persisted map, not the atom — a queue an
// earlier test left in storage would otherwise sit ahead of this test's send.
window.localStorage.removeItem('hermes.desktop.composerQueue.v1')
@@ -322,7 +322,7 @@ describe('terminal receipt settlement', () => {
try {
expect(await handle!.submitText('next input', { fromQueue: true })).toBe(true)
expect(handle!.state()).toMatchObject({ busy: true, awaitingResponse: true, streamId: 'owner-stream', turnLive: true })
- expect(Object.keys(window.localStorage).filter(key => key.startsWith('hermes.desktop.preparedSubmissions.v2:'))).toEqual([])
+ expect(storedJournal()).toEqual({})
} finally { $connection.set(null) }
})