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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user