smartlog-destination-local/test/test.js

98 lines
15 KiB
JavaScript
Raw Normal View History

2016-05-13 23:18:44 +00:00
"use strict";
2016-02-23 13:34:40 +00:00
/// <reference path="../ts/typings/main.d.ts" />
2016-02-23 14:40:18 +00:00
var beautylog = require('../dist/index.js');
2016-02-02 15:49:16 +00:00
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 () {
2016-02-11 03:04:49 +00:00
it("should print a red error message", function () {
2016-02-02 15:49:16 +00:00
beautylog.error('beautylog.error(), with normal logText, without logType');
});
});
2016-05-13 23:18:44 +00:00
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" });
});
});
2016-02-02 15:49:16 +00:00
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');
});
});
2016-05-13 23:18:44 +00:00
describe(".ora(text,color)", function () {
it("should display, update, and end a message", function (done) {
this.timeout(10000);
var testOra = beautylog.ora("This is a test text", "green", true);
2016-05-13 23:18:44 +00:00
setTimeout(function () {
testOra.text("updated text!");
testOra.log("an intermediate log message", "info");
2016-05-13 23:18:44 +00:00
setTimeout(function () {
testOra.endOk("Allright, ora works!");
done();
}, 2000);
}, 2000);
});
it("should display an error message when ended with error", function (done) {
this.timeout(10000);
var testOra = beautylog.ora("This is another test text", "green");
setTimeout(function () {
testOra.endError("Allright, ora displays an error!");
done();
}, 2000);
});
});
2016-02-02 15:49:16 +00:00
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 () {
2016-05-13 23:18:44 +00:00
var testTable1 = beautylog.table("checks");
2016-02-02 15:49:16 +00:00
testTable1.push(['check1', 'success']);
testTable1.push(['check2', 'error']);
testTable1.push(['check3', 'error']);
testTable1.print();
2016-05-13 23:18:44 +00:00
var testTable2 = beautylog.table("custom", ["Column1".red, "Column2".blue, "Column3".cyan]);
2016-02-02 15:49:16 +00:00
testTable2.push(["Hey", "this", "works"]);
testTable2.print();
})();
});
});
});
2016-02-20 09:52:23 +00:00
2016-05-14 14:37:47 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGdEQUFnRDtBQUNoRCxJQUFPLFNBQVMsV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRS9DLFFBQVEsQ0FBQyxXQUFXLEVBQUM7SUFDakIsUUFBUSxDQUFDLHVCQUF1QixFQUFDO1FBQzdCLEVBQUUsQ0FBQyxzQkFBc0IsRUFBQztZQUN0QixTQUFTLENBQUMsR0FBRyxDQUFDLHVEQUF1RCxDQUFDLENBQUM7UUFDM0UsQ0FBQyxDQUFDLENBQUM7UUFDSCxFQUFFLENBQU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