Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 1x 1x 1x 1x 1x 5x 5x 5x 5x 1x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 1x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const sinon = require('sinon'); import Logger from './logger'; import * as log from 'loglevel'; describe('Infrastructure - Log - Display informations', () => { let logStubDebug; let logStubInfo; let logStubWarn; let logStubError; beforeEach(() => { logStubDebug = sinon.stub(log, 'debug'); logStubInfo = sinon.stub(log, 'info'); logStubWarn = sinon.stub(log, 'warn'); logStubError = sinon.stub(log, 'error'); }); afterEach(() => { logStubDebug.restore(); logStubInfo.restore(); logStubWarn.restore(); logStubError.restore(); }); it('with log', async () => { Logger.log('log information'); sinon.assert.calledOnce(log.debug); }); it('with debug', async () => { Logger.debug('debug information'); sinon.assert.calledOnce(log.debug); }); it('with info', async () => { Logger.info('info information'); sinon.assert.calledOnce(log.info); }); it('with warn', async () => { Logger.warn('warn information'); sinon.assert.calledOnce(log.warn); }); it('with error', async () => { Logger.error('error information'); sinon.assert.calledOnce(log.error); }); }); describe(`Infrastructure - Log - Doesn't display informations`, () => { let logStubDebug; let logStubInfo; let logStubWarn; let logStubError; beforeEach(() => { logStubDebug = sinon.stub(log, 'debug'); logStubInfo = sinon.stub(log, 'info'); logStubWarn = sinon.stub(log, 'warn'); logStubError = sinon.stub(log, 'error'); }); afterEach(() => { logStubDebug.restore(); logStubInfo.restore(); logStubWarn.restore(); logStubError.restore(); }); before(() => { Logger.silent = true; }); it('with log', async () => { Logger.log('log information'); sinon.assert.notCalled(log.debug); }); it('with debug', async () => { Logger.debug('debug information'); sinon.assert.notCalled(log.debug); }); it('with info', async () => { Logger.info('info information'); sinon.assert.notCalled(log.info); }); it('with warn', async () => { Logger.warn('warn information'); sinon.assert.notCalled(log.warn); }); it('with error', async () => { Logger.error('error information'); sinon.assert.notCalled(log.error); }); }); |