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:
Knacky
2026-05-28 06:43:33 +02:00
parent 90fc5bab6c
commit 2b700115e8
5 changed files with 30 additions and 30 deletions

View File

@@ -59,13 +59,13 @@ describe('TemplatesListPage', () => {
});
it('shows loading state initially', () => {
mock.onGet('/simulation-templates').reply(() => new Promise(() => {}));
mock.onGet('/templates').reply(() => new Promise(() => {}));
renderWithProviders(<TemplatesListPage />);
expect(screen.getByTestId('loading-state')).toBeInTheDocument();
});
it('shows error state on failure', async () => {
mock.onGet('/simulation-templates').reply(500, { error: 'Server error' });
mock.onGet('/templates').reply(500, { error: 'Server error' });
renderWithProviders(<TemplatesListPage />);
await waitFor(() => {
expect(screen.getByTestId('error-state')).toBeInTheDocument();
@@ -73,7 +73,7 @@ describe('TemplatesListPage', () => {
});
it('shows empty state when no templates', async () => {
mock.onGet('/simulation-templates').reply(200, []);
mock.onGet('/templates').reply(200, []);
renderWithProviders(<TemplatesListPage />);
await waitFor(() => {
expect(screen.getByTestId('empty-state')).toBeInTheDocument();
@@ -81,7 +81,7 @@ describe('TemplatesListPage', () => {
});
it('renders template list with name, MITRE count, created by', async () => {
mock.onGet('/simulation-templates').reply(200, TEMPLATES);
mock.onGet('/templates').reply(200, TEMPLATES);
renderWithProviders(<TemplatesListPage />);
await waitFor(() => {
expect(screen.getByText('Mimikatz LSASS Dump')).toBeInTheDocument();
@@ -95,7 +95,7 @@ describe('TemplatesListPage', () => {
});
it('shows New button', async () => {
mock.onGet('/simulation-templates').reply(200, TEMPLATES);
mock.onGet('/templates').reply(200, TEMPLATES);
renderWithProviders(<TemplatesListPage />);
await waitFor(() => {
expect(screen.getByText('Mimikatz LSASS Dump')).toBeInTheDocument();
@@ -104,7 +104,7 @@ describe('TemplatesListPage', () => {
});
it('shows Edit and Delete actions', async () => {
mock.onGet('/simulation-templates').reply(200, TEMPLATES);
mock.onGet('/templates').reply(200, TEMPLATES);
renderWithProviders(<TemplatesListPage />);
await waitFor(() => {
expect(screen.getByText('Mimikatz LSASS Dump')).toBeInTheDocument();
@@ -114,10 +114,10 @@ describe('TemplatesListPage', () => {
});
it('calls delete endpoint on confirm', async () => {
mock.onGet('/simulation-templates').reply(200, TEMPLATES);
mock.onDelete('/simulation-templates/1').reply(204);
mock.onGet('/templates').reply(200, TEMPLATES);
mock.onDelete('/templates/1').reply(204);
// After delete, refetch returns updated list
mock.onGet('/simulation-templates').reply(200, [TEMPLATES[1]]);
mock.onGet('/templates').reply(200, [TEMPLATES[1]]);
const user = userEvent.setup();
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(true);