1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/logger.test.js
ivaosthu 1081b9d865 Implement support for logger provider.
This allows the users of 'unleash-server' to programatically
change the logger implemnentation. #175
2017-08-04 16:07:17 +02:00

23 lines
607 B
JavaScript

'use strict';
const { test } = require('ava');
const createLogger = require('./logger');
const logger = require('../logger');
const sinon = require('sinon');
test('should expose a setLoggerProvider function', t => {
t.true(logger.setLoggerProvider instanceof Function);
});
test('should create logger via custom logger provider', t => {
const provider = sinon.stub();
const loggerName = 'test';
const loggerImpl = {};
provider.withArgs(loggerName).returns(loggerImpl);
logger.setLoggerProvider(provider);
const log = createLogger(loggerName);
t.is(log, loggerImpl);
});