import { describe, expect, it } from 'vitest'; import { speakerFor } from './speaker'; describe('who answers in Ask', () => { it('names the coworker behind the tool', () => { expect(speakerFor({ tool: 'readiness' }).name).toBe('Scout'); expect(speakerFor({ tool: 'scenario' }).name).toBe('Test generator'); expect(speakerFor({ tool: 'run_status' }).name).toBe('Executor'); expect(speakerFor({ tool: 'failures' }).name).toBe('Triage'); }); it('falls back to the first card when the tool is unknown', () => { expect(speakerFor({ result: { cards: [{ type: 'changes', module: 'P2P', items: [] }], links: [], sources: [] } }).name).toBe('Scout'); }); it('actions, help and unknown answers come from the coordinator; Hermes answers as Hermes', () => { expect(speakerFor({ tool: 'start_run' })).toMatchObject({ kind: 'patchwise', name: 'Astra' }); expect(speakerFor({ tool: 'help' }).kind).toBe('patchwise'); expect(speakerFor({})).toMatchObject({ kind: 'patchwise' }); expect(speakerFor({ by: 'hermes', tool: 'readiness' })).toMatchObject({ kind: 'hermes', name: 'Hermes' }); }); });