Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(checkbox): increase coverage #1258

Merged
merged 8 commits into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions packages/checkbox/checkbox.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,55 @@ describe('checkbox prompt', () => {
await expect(answer).resolves.not.toContain(unselect);
});

it('allow disabling help tip', async () => {});
it('allow disabling help tip', async () => {
const { answer, events, getScreen } = await render(checkbox, {
message: 'Select a number',
choices: numberedChoices,
instructions: false,
});

expect(getScreen()).toMatchInlineSnapshot(`
"? Select a number
❯◯ 1
◯ 2
◯ 3
◯ 4
◯ 5
◯ 6
◯ 7
(Move up and down to reveal more choices)"
`);

events.keypress('enter');
expect(getScreen()).toMatchInlineSnapshot('"? Select a number"');

await expect(answer).resolves.toEqual([]);
});

it('allow customizing help tip', async () => {});
it('allow customizing help tip', async () => {
const { answer, events, getScreen } = await render(checkbox, {
message: 'Select a number',
choices: numberedChoices,
instructions:
' (Pulse <space> para seleccionar, <a> para alternar todos, <i> para invertir selección, y <enter> para continuar)',
});

expect(getScreen()).toMatchInlineSnapshot(`
"? Select a number (Pulse <space> para seleccionar, <a> para alternar todos, <i>
para invertir selección, y <enter> para continuar)
❯◯ 1
◯ 2
◯ 3
◯ 4
◯ 5
◯ 6
◯ 7
(Move up and down to reveal more choices)"
`);

events.keypress('enter');
expect(getScreen()).toMatchInlineSnapshot('"? Select a number"');

await expect(answer).resolves.toEqual([]);
});
});