Blueprint: Validate Blueprint name is not empty

We are now validating Blueprint name on the backend to be non-empty.
Adds same validation for frontend

Refs HMS-3801
This commit is contained in:
Ondrej Ezr 2024-03-21 14:10:50 +01:00 committed by Klara Simickova
parent 990af570d7
commit ad8fd5ddc3
4 changed files with 35 additions and 5 deletions

View file

@ -1,8 +1,9 @@
import { screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import { userEvent } from '@testing-library/user-event';
import { CREATE_BLUEPRINT } from '../../../../../constants';
import { clickNext } from '../../../../testUtils';
import { clickNext, getNextButton } from '../../../../testUtils';
import {
blueprintRequest,
clickRegisterLater,
@ -50,6 +51,31 @@ const goToReviewStep = async () => {
await clickNext();
};
describe('validates name', () => {
test('with invalid name', async () => {
await render();
await goToRegistrationStep();
await clickRegisterLater();
await goToDetailsStep();
const nextButton = await getNextButton();
expect(nextButton).toBeDisabled();
await enterBlueprintName(' ');
expect(nextButton).toBeDisabled();
});
test('with valid name', async () => {
await render();
await goToRegistrationStep();
await clickRegisterLater();
await goToDetailsStep();
await enterBlueprintName('🤣Red Velvet🤣');
const nextButton = await getNextButton();
expect(nextButton).toBeEnabled();
});
});
describe('registration request generated correctly', () => {
test('without description', async () => {
await render();