Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaweiWu committed May 3, 2022
1 parent 1084bbb commit c59e3d8
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ describe('mapFiltersToKql', () => {
});

test('should handle ruleStatusesFilter', () => {
expect(
mapFiltersToKql({
ruleStatusesFilter: ['enabled'],
})
).toEqual([
'alert.attributes.enabled:(true) and not (alert.attributes.muteAll:true OR alert.attributes.snoozeEndTime > now)',
]);

expect(
mapFiltersToKql({
ruleStatusesFilter: ['disabled'],
})
).toEqual([
'alert.attributes.enabled:(false) and not (alert.attributes.muteAll:true OR alert.attributes.snoozeEndTime > now)',
]);

expect(
mapFiltersToKql({
ruleStatusesFilter: ['snoozed'],
})
).toEqual(['(alert.attributes.muteAll:true OR alert.attributes.snoozeEndTime > now)']);

expect(
mapFiltersToKql({
ruleStatusesFilter: ['enabled', 'snoozed'],
Expand All @@ -51,10 +73,10 @@ describe('mapFiltersToKql', () => {

expect(
mapFiltersToKql({
ruleStatusesFilter: ['enabled'],
ruleStatusesFilter: ['disabled', 'snoozed'],
})
).toEqual([
'alert.attributes.enabled:(true) and not (alert.attributes.muteAll:true OR alert.attributes.snoozeEndTime > now)',
'alert.attributes.enabled:(false) or (alert.attributes.muteAll:true OR alert.attributes.snoozeEndTime > now)',
]);

expect(
Expand Down

0 comments on commit c59e3d8

Please sign in to comment.