mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
23 lines
643 B
TypeScript
23 lines
643 B
TypeScript
import { afterAll, describe, expect, it, jest } from '@jest/globals';
|
|
|
|
import { noConsoleLog } from './logger';
|
|
describe('logger', () => {
|
|
describe('noConsoleLog()', () => {
|
|
const originalConsoleLog = console.log;
|
|
|
|
afterAll(() => {
|
|
console.log = originalConsoleLog;
|
|
});
|
|
|
|
it('should overwrite and reset console.log during callback', async () => {
|
|
const consoleLogMock = jest.fn();
|
|
console.log = consoleLogMock;
|
|
await noConsoleLog(async () => {
|
|
console.log('test');
|
|
});
|
|
expect(console.log).toBe(consoleLogMock);
|
|
expect(consoleLogMock).not.toHaveBeenCalled();
|
|
});
|
|
});
|
|
});
|