From b8dc9267d85484d5626f3110c04bdf35f3770479 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Wed, 20 Nov 2024 10:12:55 +0200 Subject: [PATCH] Revert test file in security solution --- .../rule_management/api/api.test.ts | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management/api/api.test.ts b/x-pack/plugins/security_solution/public/detection_engine/rule_management/api/api.test.ts index 7fbd6a8367c31..bc7c288906e8e 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management/api/api.test.ts +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management/api/api.test.ts @@ -850,16 +850,35 @@ describe('Detections Rules API', () => { test('requests snooze settings of multiple rules by their IDs', () => { fetchRulesSnoozeSettings({ ids: ['id1', 'id2'] }); - expect(fetchMock.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "/internal/alerting/rules/_find", - Object { - "body": "{\\"filter\\":\\"alert.id:\\\\\\"alert:id1\\\\\\" or alert.id:\\\\\\"alert:id2\\\\\\"\\",\\"fields\\":\\"[\\\\\\"muteAll\\\\\\",\\\\\\"activeSnoozes\\\\\\",\\\\\\"isSnoozedUntil\\\\\\",\\\\\\"snoozeSchedule\\\\\\"]\\",\\"per_page\\":2}", - "method": "POST", - "signal": undefined, - }, - ] - `); + + expect(fetchMock).toHaveBeenCalledWith( + expect.any(String), + expect.objectContaining({ + body: '{"filter":"alert.id:\\"alert:id1\\" or alert.id:\\"alert:id2\\"","fields":"[\\"muteAll\\",\\"activeSnoozes\\",\\"isSnoozedUntil\\",\\"snoozeSchedule\\"]","per_page":2}', + }) + ); + }); + + test('requests the same number of rules as the number of ids provided', () => { + fetchRulesSnoozeSettings({ ids: ['id1', 'id2'] }); + + expect(fetchMock).toHaveBeenCalledWith( + expect.any(String), + expect.objectContaining({ + body: '{"filter":"alert.id:\\"alert:id1\\" or alert.id:\\"alert:id2\\"","fields":"[\\"muteAll\\",\\"activeSnoozes\\",\\"isSnoozedUntil\\",\\"snoozeSchedule\\"]","per_page":2}', + }) + ); + }); + + test('requests only snooze settings fields', () => { + fetchRulesSnoozeSettings({ ids: ['id1', 'id2'] }); + + expect(fetchMock).toHaveBeenCalledWith( + expect.any(String), + expect.objectContaining({ + body: '{"filter":"alert.id:\\"alert:id1\\" or alert.id:\\"alert:id2\\"","fields":"[\\"muteAll\\",\\"activeSnoozes\\",\\"isSnoozedUntil\\",\\"snoozeSchedule\\"]","per_page":2}', + }) + ); }); test('returns mapped data', async () => {