Skip to content

Commit

Permalink
test(checkbox): increase coverage (#1258)
Browse files Browse the repository at this point in the history
* test(checkbox): increase coverage

* submit

* cover

* change

* fix

* fix test

* fix test

* fix test
  • Loading branch information
zonemeen authored Jul 12, 2023
1 parent 177e359 commit 9d6a7db
Showing 1 changed file with 50 additions and 2 deletions.
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([]);
});
});

0 comments on commit 9d6a7db

Please sign in to comment.