Files
orca/src/shared/agent-title-decoration.test.ts
T
Jinjing 7caa582841 Show coding agent icons on mobile terminal tabs (#6792)
* Show coding agent icons on mobile terminal tabs

Move agent title decoration and terminal title parsing utilities
from the desktop renderer to shared code for reuse on mobile.

* Extract agent title stripping and terminal agent resolution to shared
* Implement mobile agent identity resolution and title-cleaning helpers
* Render agent icons on mobile terminal tabs when an agent is active
* Strip leading status glyphs from tab titles when showing an icon

* Suppress PTY resize on resume for mobile-driven terminals

Avoid reasserting the PTY size on resume if desktop resizing is
suppressed. This prevents overriding the intentional drift from
desktop dimensions for parked or mobile-driven terminals.
2026-06-29 16:06:27 -07:00

36 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
stripLeadingAgentTitleDecoration,
stripLeadingAgentTitleDecorationOrEmpty
} from './agent-title-decoration'
describe('stripLeadingAgentTitleDecoration', () => {
it("strips Claude's ✳ idle glyph", () => {
expect(stripLeadingAgentTitleDecoration('✳ Claude Code')).toBe('Claude Code')
})
it("strips Claude's working/idle text prefixes", () => {
expect(stripLeadingAgentTitleDecoration('. working on the fix')).toBe('working on the fix')
expect(stripLeadingAgentTitleDecoration('* Claude Code')).toBe('Claude Code')
})
it('strips a leading braille spinner', () => {
expect(stripLeadingAgentTitleDecoration('⠋ Pi')).toBe('Pi')
})
it('leaves an undecorated title untouched', () => {
expect(stripLeadingAgentTitleDecoration('Dolphin-2')).toBe('Dolphin-2')
expect(stripLeadingAgentTitleDecoration('npm run dev')).toBe('npm run dev')
})
it('keeps the original when the title is only a status glyph', () => {
expect(stripLeadingAgentTitleDecoration('✳')).toBe('✳')
expect(stripLeadingAgentTitleDecoration('✳ ')).toBe('✳ ')
})
it('can strip to empty when the caller supplies its own fallback label', () => {
expect(stripLeadingAgentTitleDecorationOrEmpty('✳')).toBe('')
expect(stripLeadingAgentTitleDecorationOrEmpty('✳ ')).toBe('')
})
})