mice-log
Version:
logging component - mice style
27 lines (26 loc) • 1.17 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const chai_spies_1 = __importDefault(require("chai-spies"));
const filter_1 = require("./filter");
(0, chai_1.use)(chai_spies_1.default);
describe('filter by severity', () => {
it('should call action if asked severity more severe that the allowed', () => {
const action = (0, chai_1.spy)();
(0, filter_1.filter)('error', 'verbose', action);
(0, chai_1.expect)(action).to.have.been.called();
});
it('should call action if severity is the same', () => {
const action = (0, chai_1.spy)();
(0, filter_1.filter)('error', 'error', action);
(0, chai_1.expect)(action).to.have.been.called();
});
it('should not call action when severity is lower than allowed', () => {
const action = (0, chai_1.spy)();
(0, filter_1.filter)('verbose', 'error', action);
(0, chai_1.expect)(action).have.not.been.called();
});
});