From b61ab61638e5160b7862478cf7a38a585ea8d567 Mon Sep 17 00:00:00 2001 From: andreidobrinski Date: Thu, 22 Aug 2024 18:05:03 -0400 Subject: [PATCH] add test for getTicketDescription --- src/inputs/getTicketDescription.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/inputs/getTicketDescription.test.js diff --git a/src/inputs/getTicketDescription.test.js b/src/inputs/getTicketDescription.test.js new file mode 100644 index 0000000..6e86551 --- /dev/null +++ b/src/inputs/getTicketDescription.test.js @@ -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(); + }); +});