Import apps/android/tests/session-title.test.ts

This commit is contained in:
QQ 2026-11-14 14:26:09 +08:00
parent 016b25f819
commit 19f68a198e
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest'
import { resolveSessionDisplayTitle } from '../src/screens/session-title'
import type { RemoteSession } from '../src/types'
describe('session display title', () => {
const session: RemoteSession = {
sessionId: 'codex:thread', backend: 'codex', updatedAt: 1, running: false, blank: false,
projections: { values: { summary: 'Review the latest PR' } },
}
it('uses the thread preview until an official title is available', () => {
expect(resolveSessionDisplayTitle(session)).toBe('Review the latest PR')
expect(resolveSessionDisplayTitle({ ...session, title: 'PR review' })).toBe('PR review')
expect(resolveSessionDisplayTitle({ ...session, projections: { values: { summary: 'Preview', title: 'Generated title' } } })).toBe('Generated title')
})
it('keeps empty new conversations untitled', () => {
expect(resolveSessionDisplayTitle({ ...session, projections: { values: { summary: ' ' } } })).toBeUndefined()
})
})