import {expect} from "chai";
import {ConsoleHandler} from "../../../../source/logging/handler/console.mjs";
import {LogEntry} from "../../../../source/logging/logentry.mjs";
import {TRACE, WARN, DEBUG, ERROR, FATAL, INFO} from "../../../../source/logging/logger.mjs";

describe('Logging', function () {

    describe('ConsoleHandler', function () {

        it('should create ConsoleHandler', function () {
            expect(new ConsoleHandler()).to.be.instanceof(ConsoleHandler)
        });

        it('should log to console', function () {
            expect(new ConsoleHandler().setAll().log(new LogEntry(FATAL, [1, true, 'fatal']))).to.be.true;
        });

        it('should log to console', function () {
            expect(new ConsoleHandler().setAll().log(new LogEntry(TRACE, [1, true, 'trace']))).to.be.true;
        });

        it('should log to console', function () {
            expect(new ConsoleHandler().setAll().log(new LogEntry(WARN, [1, true, 'warn']))).to.be.true;
        });

        it('should log to console', function () {
            expect(new ConsoleHandler().setAll().log(new LogEntry(DEBUG, [1, true, 'debug']))).to.be.true;
        });

        it('should log to console', function () {
            expect(new ConsoleHandler().setAll().log(new LogEntry(ERROR, [1, true, 'error']))).to.be.true;
        });

        it('should log to console', function () {
            expect(new ConsoleHandler().setAll().log(new LogEntry(INFO, [1, true, 'info']))).to.be.true;
        });
    });


});