Skip to content

Commit

Permalink
test: add a couple more regex tests for ignoredMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjones committed Feb 28, 2020
1 parent bd2031d commit bf65a86
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/predicates.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,19 @@ describe('messageIsIgnored', function() {
expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
});
it('false if ignoredMessages regex match', function() {
var item = {
level: 'critical',
body: {
message: {body: 'This is an ignored message'}
}
};
var settings = {
reportLevel: 'debug',
ignoredMessages: ['^This is an .{7} message$']
};
expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
});
it('false if ignoredMessages literal match', function() {
var item = {
level: 'critical',
body: {
Expand All @@ -390,6 +403,19 @@ describe('messageIsIgnored', function() {
};
expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
});
it('false if ignoredMessages more literal regex matches', function() {
var item = {
level: 'critical',
body: {
message: {body: 'Match these characters: (*+?)'}
}
};
var settings = {
reportLevel: 'debug',
ignoredMessages: ['\\(\\*\\+\\?\\)']
};
expect(p.messageIsIgnored(logger)(item, settings)).to.not.be.ok();
});
it('true if both trace and body message but ignoredMessages only match body', function() {
var item = {
level: 'critical',
Expand Down

0 comments on commit bf65a86

Please sign in to comment.