Skip to content

The agent that grows with you

test(desktop): cover a messaging completion lighting the unread marker (currently failing)

KoNit-K785dd823c16b
diff --git a/apps/desktop/src/store/session-states-eviction.test.ts b/apps/desktop/src/store/session-states-eviction.test.ts
index b82aa797560..80bad1d73dd 100644
--- a/apps/desktop/src/store/session-states-eviction.test.ts
+++ b/apps/desktop/src/store/session-states-eviction.test.ts
@@ -1,7 +1,14 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { createClientSessionState } from '@/lib/chat-runtime'
-import { $activeSessionId, $selectedStoredSessionId, $sessions, $unreadFinishedSessionIds } from '@/store/session'
+import {
+ $activeSessionId,
+ $messagingSessions,
+ $selectedStoredSessionId,
+ $sessions,
+ $unreadFinishedSessionIds
+} from '@/store/session'
+import { makeSessionInfo } from '@/test/session-info'
import { $sessionStates, $sessionTiles, closeSessionTile, publishSessionState } from '@/store/session-states'
/**
@@ -22,6 +29,7 @@ beforeEach(() => {
$sessionStates.set({})
$sessionTiles.set([])
$sessions.set([])
+ $messagingSessions.set([])
$activeSessionId.set(null)
$selectedStoredSessionId.set(null)
$unreadFinishedSessionIds.set([])
@@ -40,6 +48,15 @@ describe('publish-time eviction', () => {
expect($unreadFinishedSessionIds.get()).toContain('stored-1')
})
+ it('does not mark an external messaging completion unread', () => {
+ $messagingSessions.set([makeSessionInfo({ id: 'wechat-1', source: 'weixin' })])
+
+ publishSessionState('rt-wechat', state('wechat-1', { busy: true }))
+ publishSessionState('rt-wechat', state('wechat-1', { busy: false }))
+
+ expect($unreadFinishedSessionIds.get()).not.toContain('wechat-1')
+ })
+
it('keeps a busy session with no surface — its background turn feeds the sidebar dot', () => {
publishSessionState('rt-1', state('stored-1', { busy: true }))
publishSessionState('rt-1', state('stored-1', { busy: true, awaitingResponse: true }))