@schukai/monster
Version:
Monster is a simple library for creating fast, robust and lightweight websites.
89 lines (75 loc) • 2.68 kB
JavaScript
import {expect} from "chai"
import {Logger, OFF, ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL} from "../../../source/logging/logger.mjs";
describe('Logging', function () {
describe('new Logger', function () {
it('should return instanceof Logger', function () {
expect(new Logger()).to.instanceOf(Logger);
});
});
describe('Logger.logTrace()', function () {
it('should return instanceof Logger', function () {
expect(new Logger().logTrace("test")).to.instanceOf(Logger);
});
});
describe('Logger.logDebug()', function () {
it('should return instanceof Logger', function () {
expect(new Logger().logDebug("test")).to.instanceOf(Logger);
});
});
describe('Logger.logInfo()', function () {
it('should return instanceof Logger', function () {
expect(new Logger().logInfo("test")).to.instanceOf(Logger);
});
});
describe('Logger.logWarn()', function () {
it('should return instanceof Logger', function () {
expect(new Logger().logWarn("test")).to.instanceOf(Logger);
});
});
describe('Logger.logError()', function () {
it('should return instanceof Logger', function () {
expect(new Logger().logError("test")).to.instanceOf(Logger);
});
});
describe('Logger.logFatal()', function () {
it('should return instanceof Logger', function () {
expect(new Logger().logFatal("test")).to.instanceOf(Logger);
});
});
describe('Logger.getLevel()', function () {
[
['ALL', ALL],
['TRACE', TRACE],
['DEBUG', DEBUG],
['INFO', INFO],
['WARN', WARN],
['ERROR', ERROR],
['FATAL', FATAL],
['OFF', OFF],
].forEach(function (data) {
let a = data.shift()
let b = data.shift()
it(a + ' should return ' + b, function () {
expect(new Logger().getLevel(a)).to.be.equals(b);
});
});
});
describe('Logger.getLabel()', function () {
[
['ALL', ALL],
['TRACE', TRACE],
['DEBUG', DEBUG],
['INFO', INFO],
['WARN', WARN],
['ERROR', ERROR],
['FATAL', FATAL],
['OFF', OFF],
].forEach(function (data) {
let a = data.shift()
let b = data.shift()
it(a + ' should return ' + b, function () {
expect(new Logger().getLabel(b)).to.be.equals(a);
});
});
});
});