Skip to content

Commit

Permalink
- updated test fetch -> post
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-goldstein committed Dec 23, 2024
1 parent fdc75d0 commit 05d6d35
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('useAttackDiscovery', () => {
await act(async () => {
await result.current.fetchAttackDiscoveries();
});
expect(mockedUseKibana.services.http.fetch).toHaveBeenCalledWith(
expect(mockedUseKibana.services.http.post).toHaveBeenCalledWith(
'/internal/elastic_assistant/attack_discovery',
{
body: `{"alertsIndexPattern":"alerts-index-pattern","anonymizationFields":[],"replacements":{},"size":${SIZE},"subAction":"invokeAI","apiConfig":{"connectorId":"test-id","actionTypeId":".gen-ai"}}`,
Expand All @@ -172,7 +172,7 @@ describe('useAttackDiscovery', () => {
it('handles fetch errors correctly', async () => {
const errorMessage = 'Fetch error';
const error = new Error(errorMessage);
(mockedUseKibana.services.http.fetch as jest.Mock).mockRejectedValue(error);
(mockedUseKibana.services.http.post as jest.Mock).mockRejectedValue(error);

const { result } = renderHook(() => useAttackDiscovery({ connectorId: 'test-id', size: SIZE }));

Expand Down

0 comments on commit 05d6d35

Please sign in to comment.