const sinon = require('sinon'); // eslint-disable-line node/no-unpublished-require
-const nop = () => { /* */ };
+const nop = () => undefined;
class StubLogger {
constructor(verbose = false) {
const logger = (process.env.VERBOSE_TESTS || verbose) ? console : StubLogger._nullLogger;
Object.keys(StubLogger._nullLogger).forEach((level) => {
this[level] = logger[level]; // eslint-disable-line security/detect-object-injection
+ sinon.spy(this, level);
});
}
}
_reset() {
- Object.keys(StubLogger._nullLogger).forEach((level) => sinon.spy(this, level));
+ StubLogger._levels.forEach((level) => this[level].resetHistory()); // eslint-disable-line security/detect-object-injection
}
}
logger._reset();
});
it('covers levels', logAllLevels);
+ it('covers reset', function () {
+ logAllLevels();
+ logger._reset();
+ logAllLevels();
+ logger._reset();
+ });
}); // null logger
describe('console logger', function () {
beforeEach(function () {
logger._reset();
});
it('covers levels', logAllLevels);
+ it('covers reset', function () {
+ logAllLevels();
+ logger._reset();
+ logAllLevels();
+ logger._reset();
+ });
}); // null logger
}); // StubLogger
\ No newline at end of file