fix(frontend): sprint 5 — correct API path /simulation-templates → /templates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ describe('TemplateFormPage — new mode', () => {
|
||||
});
|
||||
|
||||
it('submits POST when name is filled', async () => {
|
||||
mock.onPost('/simulation-templates').reply(201, { ...TEMPLATE, id: 99 });
|
||||
mock.onPost('/templates').reply(201, { ...TEMPLATE, id: 99 });
|
||||
const user = userEvent.setup();
|
||||
renderNew();
|
||||
await user.type(screen.getByLabelText(/Name/i), 'My Template');
|
||||
@@ -125,7 +125,7 @@ describe('TemplateFormPage — new mode', () => {
|
||||
});
|
||||
|
||||
it('shows backend error on name conflict (409)', async () => {
|
||||
mock.onPost('/simulation-templates').reply(409, { error: 'template name already exists' });
|
||||
mock.onPost('/templates').reply(409, { error: 'template name already exists' });
|
||||
const user = userEvent.setup();
|
||||
renderNew();
|
||||
await user.type(screen.getByLabelText(/Name/i), 'Duplicate');
|
||||
@@ -153,7 +153,7 @@ describe('TemplateFormPage — edit mode', () => {
|
||||
});
|
||||
|
||||
it('loads existing template data into form', async () => {
|
||||
mock.onGet('/simulation-templates/5').reply(200, TEMPLATE);
|
||||
mock.onGet('/templates/5').reply(200, TEMPLATE);
|
||||
renderEdit(5);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByDisplayValue('Mimikatz LSASS Dump')).toBeInTheDocument();
|
||||
@@ -162,7 +162,7 @@ describe('TemplateFormPage — edit mode', () => {
|
||||
});
|
||||
|
||||
it('shows technique and tactic chips from existing template', async () => {
|
||||
mock.onGet('/simulation-templates/5').reply(200, TEMPLATE);
|
||||
mock.onGet('/templates/5').reply(200, TEMPLATE);
|
||||
renderEdit(5);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTitle('T1003 — OS Credential Dumping')).toBeInTheDocument();
|
||||
@@ -171,7 +171,7 @@ describe('TemplateFormPage — edit mode', () => {
|
||||
});
|
||||
|
||||
it('shows Delete button in edit mode', async () => {
|
||||
mock.onGet('/simulation-templates/5').reply(200, TEMPLATE);
|
||||
mock.onGet('/templates/5').reply(200, TEMPLATE);
|
||||
renderEdit(5);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByDisplayValue('Mimikatz LSASS Dump')).toBeInTheDocument();
|
||||
@@ -180,8 +180,8 @@ describe('TemplateFormPage — edit mode', () => {
|
||||
});
|
||||
|
||||
it('submits PATCH on save', async () => {
|
||||
mock.onGet('/simulation-templates/5').reply(200, TEMPLATE);
|
||||
mock.onPatch('/simulation-templates/5').reply(200, { ...TEMPLATE, name: 'Updated' });
|
||||
mock.onGet('/templates/5').reply(200, TEMPLATE);
|
||||
mock.onPatch('/templates/5').reply(200, { ...TEMPLATE, name: 'Updated' });
|
||||
const user = userEvent.setup();
|
||||
renderEdit(5);
|
||||
await waitFor(() => {
|
||||
@@ -196,8 +196,8 @@ describe('TemplateFormPage — edit mode', () => {
|
||||
});
|
||||
|
||||
it('opens delete confirm dialog and calls DELETE on confirm', async () => {
|
||||
mock.onGet('/simulation-templates/5').reply(200, TEMPLATE);
|
||||
mock.onDelete('/simulation-templates/5').reply(204);
|
||||
mock.onGet('/templates/5').reply(200, TEMPLATE);
|
||||
mock.onDelete('/templates/5').reply(204);
|
||||
const user = userEvent.setup();
|
||||
renderEdit(5);
|
||||
await waitFor(() => {
|
||||
|
||||
Reference in New Issue
Block a user