Skip to content

Commit

Permalink
add test for getTicketDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidobrinski committed Aug 22, 2024
1 parent d271078 commit b61ab61
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/inputs/getTicketDescription.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { describe, expect, test } from 'vitest';
import { resolve } from 'path';
import { render } from 'cli-testing-library';

const resolvedPath = resolve(__dirname, './getTicketDescription.js');

describe(`The getTicketDescription function`, () => {
test('shows an error when submitting with no text', async () => {
const { userEvent, findByText } = await render(
`node -e 'import("${resolvedPath}").then(module => module.getTicketDescription())'`
);

userEvent.keyboard('[Enter]');

const errorText = await findByText('must provide a value');
expect(errorText).toBeTruthy();
});
});

0 comments on commit b61ab61

Please sign in to comment.