import { describe, expect, it } from 'vitest' import { resolveTerminalTabTitle, resolveUnifiedTabLabel } from './tab-title-resolution' describe('tab title resolution', () => { it('uses live terminal titles when generated titles are disabled', () => { expect( resolveTerminalTabTitle( { customTitle: null, generatedTitle: 'Refactor auth', title: 'Claude working' }, false ) ).toBe('Claude working') }) it('places generated titles between manual and live titles when enabled', () => { expect( resolveTerminalTabTitle( { customTitle: null, generatedTitle: 'Refactor auth', title: 'Claude working' }, true ) ).toBe('Refactor auth') expect( resolveTerminalTabTitle( { customTitle: 'Payments', generatedTitle: 'Refactor auth', title: 'Claude working' }, true ) ).toBe('Payments') }) it('places quick command labels between manual and generated titles', () => { expect( resolveTerminalTabTitle( { customTitle: null, quickCommandLabel: 'Run tests', generatedTitle: 'Refactor auth', title: 'pnpm test' }, true ) ).toBe('Run tests') expect( resolveTerminalTabTitle( { customTitle: 'Manual label', quickCommandLabel: 'Run tests', generatedTitle: 'Refactor auth', title: 'pnpm test' }, true ) ).toBe('Manual label') }) it('uses the same priority for unified tab labels', () => { expect( resolveUnifiedTabLabel( { customLabel: null, generatedLabel: 'Fix flaky tests', label: 'Codex working' }, true ) ).toBe('Fix flaky tests') }) it('uses quick command labels before generated unified labels', () => { expect( resolveUnifiedTabLabel( { customLabel: null, quickCommandLabel: 'Run build', generatedLabel: 'Fix flaky tests', label: 'Codex working' }, true ) ).toBe('Run build') }) })