smartlog-destination-local/test/test.js
2016-02-23 14:34:40 +01:00

84 lines
13 KiB
JavaScript

/// <reference path="../ts/typings/main.d.ts" />
var smartenv = require("smartenv");
var beautylog = require('../index.js');
describe("beautylog", function () {
describe(".log(message,logtype)", function () {
it("should log cyan text", function () {
beautylog.log('beautylog.log(), with normal logText, without logType');
});
it("should print different log types dependent on logType", function () {
beautylog.log('beautylog.log(), with normal logText, without logType');
beautylog.log('beautylog.log(), with normal logText, with logType "dir"', 'dir');
beautylog.log('beautylog.log(), with normal logText, with logType "error"', 'error');
beautylog.log('beautylog.log(), with normal logText, with logType "info"', 'info');
beautylog.log('beautylog.log(), with normal logText, with logType "ok"', 'ok');
beautylog.log('beautylog.log(), with normal logText, with logType "success"', 'success');
beautylog.log('beautylog.log(), with normal logText, with logType "warn"', 'warn');
});
});
describe(".dir(message)", function () {
it("should print a blue Dir message", function () {
beautylog.dir('beautylog.dir(), with normal logText, without logType');
});
});
describe(".error(message)", function () {
it("should print a red error message", function () {
beautylog.error('beautylog.error(), with normal logText, without logType');
});
});
describe(".info(message)", function () {
it("should display a purple info message", function () {
beautylog.info('beautylog.dir(), with normal logText, without logType');
});
});
describe(".ok(message)", function () {
it("should display a green ok message", function () {
beautylog.ok('beautylog.ok(), with normal logText, without logType');
});
});
describe(".success(message)", function () {
it("should display an orange warn message", function () {
beautylog.success('beautylog.success(), with normal logText, without logType');
});
});
describe(".warn", function () {
it("should display a orange warn message", function () {
beautylog.warn('beautylog.warn(), with normal logText, without logType');
});
});
describe(".table", function () {
it("should print a nice table", function () {
(function () {
var testTable1 = beautylog.table.new("checks");
testTable1.push(['check1', 'success']);
testTable1.push(['check2', 'error']);
testTable1.push(['check3', 'error']);
testTable1.print();
var testTable2 = beautylog.table.new("custom", ["Column1".red, "Column2".blue, "Column3".cyan]);
testTable2.push(["Hey", "this", "works"]);
testTable2.print();
})();
});
});
describe(".figlet", function () {
it("should print nice fonts to console in yellow", function (done) {
beautylog.figlet("Async!", { font: "Star Wars", color: "yellow" }).then(done);
});
});
describe(".figletSync", function () {
it("should print nice fonts to console in yellow", function () {
beautylog.figletSync("Sync!", { font: "Star Wars", color: "blue" });
});
});
describe(".code", function () {
it("should highlight code", function () {
this.timeout(10000);
beautylog.code("var test = 3;\nfunction(){\n var hello = \"super\"\n};\nvar test;", {
language: "javascript"
});
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztBQUNuQyxJQUFJLFNBQVMsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFdkMsUUFBUSxDQUFDLFdBQVcsRUFBQztJQUNqQixRQUFRLENBQUMsdUJBQXVCLEVBQUM7UUFDN0IsRUFBRSxDQUFDLHNCQUFzQixFQUFDO1lBQ3RCLFNBQVMsQ0FBQyxHQUFHLENBQUMsdURBQXVELENBQUMsQ0FBQztRQUMzRSxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyx1REFBdUQsRUFBQztZQUN2RCxTQUFTLENBQUMsR0FBRyxDQUFDLHVEQUF1RCxDQUFDLENBQUM7WUFDdkUsU0FBUyxDQUFDLEdBQUcsQ0FBQywwREFBMEQsRUFBQyxLQUFLLENBQUMsQ0FBQztZQUNoRixTQUFTLENBQUMsR0FBRyxDQUFDLDREQUE0RCxFQUFDLE9BQU8sQ0FBQyxDQUFDO1lBQ3BGLFNBQVMsQ0FBQyxHQUFHLENBQUMsMkRBQTJELEVBQUMsTUFBTSxDQUFDLENBQUM7WUFDbEYsU0FBUyxDQUFDLEdBQUcsQ0FBQyx5REFBeUQsRUFBQyxJQUFJLENBQUMsQ0FBQztZQUM5RSxTQUFTLENBQUMsR0FBRyxDQUFDLDhEQUE4RCxFQUFDLFNBQVMsQ0FBQy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ICAgICAgICAgICAoZnVuY3Rpb24oKXtcbiAgICAgICAgICAgICAgICB2YXIgdGVzdFRhYmxlMSA9IGJlYXV0eWxvZy50YWJsZS5uZXcoXCJjaGVja3NcIik7XG4gICAgICAgICAgICAgICAgdGVzdFRhYmxlMS5wdXNoKFsnY2hlY2sxJywnc3VjY2VzcyddKTtcbiAgICAgICAgICAgICAgICB0ZXN0VGFibGUxLnB1c2goWydjaGVjazInLCdlcnJvciddKTtcbiAgICAgICAgICAgICAgICB0ZXN0VGFibGUxLnB1c2goWydjaGVjazMnLCdlcnJvciddKTtcbiAgICAgICAgICAgICAgICB0ZXN0VGFibGUxLnByaW50KCk7XG5cbiAgICAgICAgICAgICAgICB2YXIgdGVzdFRhYmxlMiA9IGJlYXV0eWxvZy50YWJsZS5uZXcoXCJjdXN0b21cIixbXCJDb2x1bW4xXCIucmVkLFwiQ29sdW1uMlwiLmJsdWUsXCJDb2x1bW4zXCIuY3lhbl0pO1xuICAgICAgICAgICAgICAgIHRlc3RUYWJsZTIucHVzaChbXCJIZXlcIixcInRoaXNcIixcIndvcmtzXCJdKTtcbiAgICAgICAgICAgICAgICB0ZXN0VGFibGUyLnByaW50KCk7XG4gICAgICAgICAgICB9KSgpO1xuICAgICAgICB9KTtcbiAgICB9KTtcbiAgICBkZXNjcmliZShcIi5maWdsZXRcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBwcmludCBuaWNlIGZvbnRzIHRvIGNvbnNvbGUgaW4geWVsbG93XCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICBiZWF1dHlsb2cuZmlnbGV0KFwiQXN5bmMhXCIse2ZvbnQ6XCJTdGFyIFdhcnNcIixjb2xvcjpcInllbGxvd1wifSkudGhlbihkb25lKTtcbiAgICAgICAgfSlcbiAgICB9KTtcbiAgICBkZXNjcmliZShcIi5maWdsZXRTeW5jXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgcHJpbnQgbmljZSBmb250cyB0byBjb25zb2xlIGluIHllbGxvd1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBiZWF1dHlsb2cuZmlnbGV0U3luYyhcIlN5bmMhXCIse2ZvbnQ6XCJTdGFyIFdhcnNcIixjb2xvcjpcImJsdWVcIn0pO1xuICAgICAgICB9KVxuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiLmNvZGVcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBoaWdobGlnaHQgY29kZVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgYmVhdXR5bG9nLmNvZGUoXG4gICAgICAgICAgICAgICAgXCJ2YXIgdGVzdCA9IDM7XFxuZnVuY3Rpb24oKXtcXG4gIHZhciBoZWxsbyA9IFxcXCJzdXBlclxcXCJcXG59O1xcbnZhciB0ZXN0O1wiLFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgbGFuZ3VhZ2U6XCJqYXZhc2NyaXB0XCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApO1xuICAgICAgICB9KVxuICAgIH0pXG59KTtcblxuXG4iXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=