1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/logger.test.js
Ivar Conradi Østhus d01c9d2dac
fix: use airbnb lint rules directly (#583)
This drops usage of finn-eslint rules as they are no
longer maintained.
2020-04-14 22:29:11 +02:00

41 lines
1.0 KiB
JavaScript

'use strict';
const test = require('ava');
const logger = require('./logger');
test('should expose a setLoggerProvider function', t => {
t.true(logger.setLoggerProvider instanceof Function);
});
test('should require custom logger to implement info', t => {
const loggerImpl = {
debug: () => {},
warn: () => {},
error: () => {},
};
const provider = () => loggerImpl;
const error = t.throws(
() => {
logger.setLoggerProvider(provider)();
},
{ instanceOf: TypeError },
);
t.is(error.message, 'Logger must implement info');
});
test('should require custom logger to implement error', t => {
const loggerImpl = {
debug: () => {},
warn: () => {},
info: () => {},
};
const provider = () => loggerImpl;
const error = t.throws(
() => {
logger.setLoggerProvider(provider)();
},
{ instanceOf: TypeError },
);
t.is(error.message, 'Logger must implement error');
});