smartlog-destination-local/test/test.js

88 lines
7.2 KiB
JavaScript
Raw Normal View History

2016-05-13 23:18:44 +00:00
"use strict";
2016-05-23 14:22:20 +00:00
require("typings-test");
2016-10-16 00:26:43 +00:00
const beautylog = require("../dist/index");
describe('beautylog', function () {
describe('.log(message)', function () {
it('should print a blue Dir message', function () {
2016-02-02 15:49:16 +00:00
beautylog.log('beautylog.log(), with normal logText, without logType');
});
});
2016-10-16 00:26:43 +00:00
describe('.dir(message)', function () {
it('should print a blue Dir message', function () {
2016-02-02 15:49:16 +00:00
beautylog.dir('beautylog.dir(), with normal logText, without logType');
});
});
2016-10-16 00:26:43 +00:00
describe('.error(message)', function () {
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-10-16 00:26:43 +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);
2016-05-13 23:18:44 +00:00
});
});
2016-10-16 00:26:43 +00:00
describe('.figletSync', function () {
it('should print nice fonts to console in yellow', function () {
beautylog.figletSync('Sync!', { font: 'Star Wars', color: 'blue' });
2016-05-13 23:18:44 +00:00
});
});
2016-10-16 00:26:43 +00:00
describe('.info(message)', function () {
it('should display a purple info message', function () {
2016-02-02 15:49:16 +00:00
beautylog.info('beautylog.dir(), with normal logText, without logType');
});
});
2016-10-16 00:26:43 +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-06-16 21:57:49 +00:00
});
});
2016-10-16 00:26:43 +00:00
describe('.ok(message)', function () {
it('should display a green ok message', function () {
2016-02-02 15:49:16 +00:00
beautylog.ok('beautylog.ok(), with normal logText, without logType');
});
});
2016-10-16 00:26:43 +00:00
describe('.newLine(number)', function () {
it('create specified amount of new lines', function () {
2016-06-16 00:17:28 +00:00
beautylog.newLine(1);
});
});
2016-10-16 00:26:43 +00:00
describe('.ora(text,color)', function () {
it('should display, update, and end a message', function (done) {
2016-05-13 23:18:44 +00:00
this.timeout(10000);
2016-10-16 00:26:43 +00:00
let testOra = new beautylog.Ora('This is a test text', 'green', true);
2016-05-13 23:18:44 +00:00
setTimeout(function () {
2016-10-16 00:26:43 +00:00
testOra.text('updated text!');
beautylog.info('another log message that uses the normal log function');
2016-05-13 23:18:44 +00:00
setTimeout(function () {
2016-10-16 00:26:43 +00:00
testOra.endOk('Allright, ora works!');
2016-05-13 23:18:44 +00:00
done();
}, 2000);
}, 2000);
});
2016-10-16 00:26:43 +00:00
it('should display an error message when ended with error', function (done) {
2016-05-13 23:18:44 +00:00
this.timeout(10000);
2016-10-16 00:26:43 +00:00
let testOra = new beautylog.Ora('This is another test text', 'green');
2016-05-13 23:18:44 +00:00
setTimeout(function () {
2016-10-16 00:26:43 +00:00
testOra.endError('Allright, ora displays an error!');
2016-05-13 23:18:44 +00:00
done();
}, 2000);
});
});
2016-10-16 00:26:43 +00:00
describe('.success(message)', function () {
it('should display an orange warn message', function () {
2016-02-02 15:49:16 +00:00
beautylog.success('beautylog.success(), with normal logText, without logType');
});
});
2016-10-16 00:26:43 +00:00
describe('.warn', function () {
it('should display a orange warn message', function () {
2016-02-02 15:49:16 +00:00
beautylog.warn('beautylog.warn(), with normal logText, without logType');
});
});
});
2016-10-16 00:26:43 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQiwyQ0FBMkM7QUFFM0MsUUFBUSxDQUFDLFdBQVcsRUFBQztJQUNqQixRQUFRLENBQUMsZUFBZSxFQUFDO1FBQ3JCLEVBQUUsQ0FBQyxp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