Skip to content

Commit

Permalink
Revert test file in security solution
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Nov 20, 2024
1 parent 3f3a91f commit b8dc926
Showing 1 changed file with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit b8dc926

Please sign in to comment.