2021-09-14 20:17:13 +02:00
|
|
|
import * as logger from './logger';
|
2017-08-04 16:03:15 +02:00
|
|
|
|
2021-05-28 11:10:24 +02:00
|
|
|
test('should require custom logger to implement info', () => {
|
2017-08-05 15:38:55 +02:00
|
|
|
const loggerImpl = {
|
|
|
|
debug: () => {},
|
|
|
|
warn: () => {},
|
|
|
|
error: () => {},
|
|
|
|
};
|
|
|
|
const provider = () => loggerImpl;
|
2021-05-28 11:10:24 +02:00
|
|
|
expect(() => {
|
2021-09-14 20:17:13 +02:00
|
|
|
// @ts-ignore:next-line
|
|
|
|
return logger.validateLogProvider(provider);
|
2021-05-28 11:10:24 +02:00
|
|
|
}).toThrowError(new TypeError('Logger must implement info'));
|
2017-08-05 15:38:55 +02:00
|
|
|
});
|
|
|
|
|
2021-05-28 11:10:24 +02:00
|
|
|
test('should require custom logger to implement error', () => {
|
2017-08-05 15:38:55 +02:00
|
|
|
const loggerImpl = {
|
|
|
|
debug: () => {},
|
|
|
|
warn: () => {},
|
|
|
|
info: () => {},
|
|
|
|
};
|
|
|
|
const provider = () => loggerImpl;
|
2021-05-28 11:10:24 +02:00
|
|
|
expect(() => {
|
2021-09-14 20:17:13 +02:00
|
|
|
// @ts-ignore:next-line
|
|
|
|
return logger.validateLogProvider(provider);
|
2021-05-28 11:10:24 +02:00
|
|
|
}).toThrowError(new TypeError('Logger must implement error'));
|
2017-08-05 15:38:55 +02:00
|
|
|
});
|