File size: 1,151 Bytes
af1bee9 ea59f21 af1bee9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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' });
});
});
|