Skip to content

Commit

Permalink
CR: add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliidm committed Apr 8, 2024
1 parent 778b501 commit ff8a41f
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,17 @@ describe('getSuppressionTerms', () => {
})
).toEqual([{ field: 'host.name', value: 'localhost-1' }]);
});
it('should return sorted suppression terms array', () => {
it('should return suppression terms array when fields do not have matches', () => {
expect(
getSuppressionTerms({
alertSuppression: {
groupBy: ['host.name'],
},
fields: { 'host.ip': '127.0.0.1' },
})
).toEqual([{ field: 'host.name', value: null }]);
});
it('should return sorted suppression terms array value', () => {
expect(
getSuppressionTerms({
alertSuppression: {
Expand All @@ -99,4 +109,14 @@ describe('getSuppressionTerms', () => {
})
).toEqual([{ field: 'host.name', value: ['localhost-1', 'localhost-2'] }]);
});
it('should return multiple suppression terms', () => {
expect(
getSuppressionTerms({
alertSuppression: {
groupBy: ['host.name', 'host.ip'],
},
fields: { 'host.name': ['localhost-1'], 'agent.name': 'test', 'host.ip': '127.0.0.1' },
})
).toEqual([{ field: 'host.name', value: ['localhost-1'] }, { 'host.ip': '127.0.0.1' }]);
});
});

0 comments on commit ff8a41f

Please sign in to comment.