smartlog-destination-local/test/test.ts

115 lines
4.8 KiB
TypeScript
Raw Normal View History

2016-05-23 12:30:58 +00:00
import "typings-test";
2016-06-16 00:17:28 +00:00
import beautylog = require('../dist/index');
2015-09-26 18:46:16 +00:00
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');
});
});
2016-06-16 21:57:49 +00:00
describe(".logReduced(message)",function(){
it("should only log two messages",function(){
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 1");
beautylog.logReduced("Message 2");
beautylog.logReduced("Message 2");
})
})
2016-02-02 15:49:16 +00:00
describe(".ok(message)",function(){
it("should display a green ok message",function(){
beautylog.ok('beautylog.ok(), with normal logText, without logType');
});
});
2016-06-16 00:17:28 +00:00
describe(".newLine(number)",function(){
it("create specified amount of new lines",function(){
beautylog.newLine(1);
});
});
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);
2016-05-14 21:58:40 +00:00
let testOra = new 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");
beautylog.info("another log message that uses the normal log function");
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);
2016-05-14 21:58:40 +00:00
let testOra = new beautylog.Ora("This is another test text","green");
2016-05-13 23:18:44 +00:00
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');
});
});
2016-05-14 21:58:40 +00:00
describe(".Table",function(){
2016-02-02 15:49:16 +00:00
it("should print a nice table",function(){
(function(){
2016-05-14 21:58:40 +00:00
var testTable1 = new 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();
2015-09-26 18:46:16 +00:00
2016-05-14 21:58:40 +00:00
var testTable2 = new beautylog.Table("custom",["Column1".red,"Column2".blue,"Column3".cyan]);
2016-02-02 15:49:16 +00:00
testTable2.push(["Hey","this","works"]);
testTable2.print();
})();
});
});
});
2015-09-26 18:46:16 +00:00