|
1 | 1 | import { describe, expect, test } from 'bun:test' |
2 | | -import { __getConfirmFooterTextForTests } from './StepConfirm' |
| 2 | +import { |
| 3 | + __getConfirmFooterTextForTests, |
| 4 | + __getToolSummaryForTests, |
| 5 | + __splitValidationWarningsForTests, |
| 6 | +} from './StepConfirm' |
3 | 7 |
|
4 | 8 | describe('StepConfirm footer text', () => { |
5 | 9 | test('shows save actions while idle', () => { |
6 | 10 | expect(__getConfirmFooterTextForTests(false)).toBe( |
7 | | - 'Press s/Enter to save - e to edit in your editor - Esc to cancel', |
| 11 | + 'Enter/s to save - e to save and edit - Esc to go back', |
8 | 12 | ) |
9 | 13 | }) |
10 | 14 |
|
11 | 15 | test('shows saving state while save is in progress', () => { |
12 | 16 | expect(__getConfirmFooterTextForTests(true)).toBe('Saving agent...') |
13 | 17 | }) |
14 | 18 | }) |
| 19 | + |
| 20 | +describe('StepConfirm tool summary', () => { |
| 21 | + test('describes the recommended all-tools default', () => { |
| 22 | + expect(__getToolSummaryForTests(undefined)).toBe( |
| 23 | + 'All tools (recommended default)', |
| 24 | + ) |
| 25 | + }) |
| 26 | + |
| 27 | + test('describes a no-tools specialist', () => { |
| 28 | + expect(__getToolSummaryForTests([])).toBe('No tools (strict and limited)') |
| 29 | + }) |
| 30 | + |
| 31 | + test('formats multiple selected tools', () => { |
| 32 | + expect(__getToolSummaryForTests(['Read', 'Bash', 'Edit'])).toBe( |
| 33 | + 'Read, Bash, and Edit', |
| 34 | + ) |
| 35 | + }) |
| 36 | +}) |
| 37 | + |
| 38 | +describe('StepConfirm validation message grouping', () => { |
| 39 | + test('shows tool access advisories as notes', () => { |
| 40 | + expect( |
| 41 | + __splitValidationWarningsForTests([ |
| 42 | + 'Agent has access to all tools', |
| 43 | + 'Unrecognized tools: UnknownTool', |
| 44 | + ]), |
| 45 | + ).toEqual({ |
| 46 | + notes: [ |
| 47 | + 'All tools are enabled. Limit tools only for stricter specialists.', |
| 48 | + ], |
| 49 | + warnings: ['Unrecognized tools: UnknownTool'], |
| 50 | + }) |
| 51 | + }) |
| 52 | +}) |
0 commit comments