test: Services edit tests

This adds services tests for the edit mode.
This commit is contained in:
regexowl 2025-01-28 14:19:52 +01:00 committed by Klara Simickova
parent 28253c040e
commit 16b3d60db1
3 changed files with 50 additions and 2 deletions

View file

@ -2,7 +2,9 @@ import type { Router as RemixRouter } from '@remix-run/router';
import { screen, waitFor, within } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import { CREATE_BLUEPRINT } from '../../../../../constants';
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
import { servicesCreateBlueprintRequest } from '../../../../fixtures/editMode';
import {
blueprintRequest,
clickBack,
@ -10,6 +12,8 @@ import {
enterBlueprintName,
interceptBlueprintRequest,
openAndDismissSaveAndBuildModal,
interceptEditBlueprintRequest,
renderEditMode,
verifyCancelButton,
} from '../../wizardTestUtils';
import { clickRegisterLater, renderCreateMode } from '../../wizardTestUtils';
@ -279,5 +283,22 @@ describe('Services request generated correctly', () => {
});
});
describe('Services edit mode', () => {
beforeEach(() => {
vi.clearAllMocks();
});
test('edit mode works', async () => {
const id = mockBlueprintIds['services'];
await renderEditMode(id);
// starts on review step
const receivedRequest = await interceptEditBlueprintRequest(
`${EDIT_BLUEPRINT}/${id}`
);
const expectedRequest = servicesCreateBlueprintRequest;
expect(receivedRequest).toEqual(expectedRequest);
});
});
// TO DO 'Services step' -> 'revisit step button on Review works'
// TO DO 'Services edit mode'