open-design/apps/daemon/tests/user-facing-agent-label.test.ts
吴杨帆 916438d919
fix(daemon): hide agent executable paths from chat status (#2874) (#3046)
Stop emitting resolved filesystem paths in chat start events and
inactivity-timeout diagnostics; surface agent ids instead.
Complements web-side redaction in #2894.
2026-05-27 06:22:56 +00:00

36 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { userFacingAgentLabel } from '../src/user-facing-agent-label.js';
describe('userFacingAgentLabel', () => {
it('prefers the configured agent id over the resolved executable path', () => {
expect(
userFacingAgentLabel(
'claude',
'/Applications/Open Design Beta.app/Contents/Resources/open-design/bin/claude',
),
).toBe('claude');
});
it('falls back to the executable basename when agent id is missing', () => {
expect(
userFacingAgentLabel(
null,
'/Applications/Open Design Beta.app/Contents/Resources/open-design/bin/vela',
),
).toBe('vela');
});
it('strips Windows executable extensions from basename fallbacks', () => {
expect(
userFacingAgentLabel(
'',
'C:\\Program Files\\Open Design\\resources\\open-design\\bin\\unknown.exe',
),
).toBe('unknown');
});
it('returns a generic label when neither agent id nor path is available', () => {
expect(userFacingAgentLabel(undefined, null)).toBe('agent');
});
});