-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectPromptHint.test.tsx
More file actions
36 lines (31 loc) · 1.27 KB
/
SelectPromptHint.test.tsx
File metadata and controls
36 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { render } from 'ink-testing-library';
import { SelectPromptHint } from './SelectPromptHint';
describe('SelectPromptHint', () => {
it('renders with default message', () => {
const { lastFrame } = render(<SelectPromptHint />);
expect(lastFrame()).toContain('Select option');
expect(lastFrame()).toContain('↑↓');
expect(lastFrame()).toContain('Enter');
expect(lastFrame()).toContain('Esc');
expect(lastFrame()).toContain('Ctrl+C');
expect(lastFrame()).toContain('cancel');
});
it('renders with custom message', () => {
const { lastFrame } = render(<SelectPromptHint message="Choose model" />);
expect(lastFrame()).toContain('Choose model');
expect(lastFrame()).toContain('↑↓');
expect(lastFrame()).toContain('Enter');
});
it('renders with custom escape label', () => {
const { lastFrame } = render(<SelectPromptHint escapeLabel="go back" />);
expect(lastFrame()).toContain('go back');
expect(lastFrame()).not.toContain('cancel');
});
it('renders with both custom message and escape label', () => {
const { lastFrame } = render(
<SelectPromptHint message="Select file" escapeLabel="abort" />,
);
expect(lastFrame()).toContain('Select file');
expect(lastFrame()).toContain('abort');
});
});