Skip to content

Commit

Permalink
mock console.warn() so it doesn't show up in test logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ForestOfLight committed Jan 25, 2025
1 parent 12573a9 commit 747fbe4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions __tests__/BP/scripts/lib/canopy/Extension.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ describe('Extension', () => {
});

describe('makeID()', () => {
console.warn = vi.fn();
it('should return a valid ID', () => {
expect(extension.makeID('TestExtension')).toBe('testextension');
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/BP/scripts/lib/canopy/Rule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ describe('Rule', () => {
});

describe('constructor', () => {
console.warn = vi.fn();
it('should add the rule to the Rules registry', () => {
expect(Rules.exists('test_rule')).toBe(true);
});

it('should warn if a rule with the same identifier already exists', () => {
console.warn = vi.fn();
new Rule({ category: 'test', identifier: 'test_rule' });
expect(console.warn).toHaveBeenCalled();
});
Expand Down

0 comments on commit 747fbe4

Please sign in to comment.