smartlog-destination-local/test/test.js

105 lines
8.4 KiB
JavaScript
Raw Normal View History

2016-05-13 23:18:44 +00:00
"use strict";
2017-03-11 11:30:18 +00:00
Object.defineProperty(exports, "__esModule", { value: true });
2016-05-23 14:22:20 +00:00
require("typings-test");
2016-10-16 00:26:43 +00:00
const beautylog = require("../dist/index");
2017-01-22 10:42:04 +00:00
const beautyremote = require("beautyremote");
const qenv = require("qenv");
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit');
2016-10-16 00:26:43 +00:00
describe('beautylog', function () {
2017-01-22 10:42:04 +00:00
describe('.registerRemote', function () {
it('should accept a beautyremote', function () {
let myRemote = new beautyremote.Loggly({
token: process.env.LOGGLY_TOKEN
});
beautylog.registerRemote(myRemote);
});
});
2016-10-16 00:26:43 +00:00
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) {
2017-01-21 18:04:40 +00:00
beautylog.figlet('Async!', { font: 'Star Wars', color: 'orange' }).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 () {
2017-01-21 22:12:39 +00:00
beautylog.ok('beautylog.ok() works!');
2016-02-02 15:49:16 +00:00
});
});
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);
2017-01-21 22:12:39 +00:00
beautylog.ora.start('This is a test text', 'green');
2016-05-13 23:18:44 +00:00
setTimeout(function () {
2017-01-21 22:12:39 +00:00
beautylog.ora.text('updated text!');
2016-10-16 00:26:43 +00:00
beautylog.info('another log message that uses the normal log function');
2016-05-13 23:18:44 +00:00
setTimeout(function () {
2017-01-21 22:12:39 +00:00
beautylog.ora.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);
2017-01-21 22:12:39 +00:00
beautylog.ora.start('This is another test text', 'green');
2016-05-13 23:18:44 +00:00
setTimeout(function () {
2017-01-21 22:12:39 +00:00
beautylog.ora.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 () {
2017-01-21 22:12:39 +00:00
beautylog.success('beautylog.success() works!');
2016-02-02 15:49:16 +00:00
});
});
2016-10-16 00:26:43 +00:00
describe('.warn', function () {
it('should display a orange warn message', function () {
2017-01-21 22:12:39 +00:00
beautylog.warn('beautylog.warn() works!');
});
});
describe('.note', function () {
it('should display a pink note', function () {
beautylog.note('beautylog.note() works!');
2016-02-02 15:49:16 +00:00
});
});
});
2017-03-11 11:30:18 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx3QkFBcUI7QUFDckIsMkNBQTJDO0FBQzNDLDZDQUE0QztBQUU1Qyw2QkFBNEI7QUFDNUIsSUFBSSxRQUFRLEdBQUcsSUFBSSxJQUFJLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsRUFBRSxPQUFPLENBQUMsR0FBRyxFQUFFLEdBQUcsU0FBUyxDQUFDLENBQUE7QUFFdEUsUUFBUSxDQUFDLFdBQVcsRUFBRTtJQUNwQixRQUFRLENBQUMsaUJBQWlCLEVBQUU7UUFDMUIsRUFBRSxDQUFDLDhCQUE4QixFQUFFO1lBQ2pDLElBQUksUUFBUSxHQUFHLElBQUksWUFBWSxDQUFDLE1BQU0sQ0FBQztnQkFDckMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsWUFBWTthQUNoQyxDQUFDLENBQUE7WUFDRixTQUFTLENBQUMsY0FBYyxDQUFDLFFBQVEsQ0FBQyxDQUFBO1FBQ3BDLENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQyxDQUFDLENBQUE7SUFDRixRQUFRLENBQUMsZUFBZSxFQUFFO1FBQ3hCLEVBQUUsQ0FBQyxpQ0FBaUMsRUFBRTtZQUNwQyxTQUFTLENBQUMsR0FBRyxDQUFDLHVEQUF1RCxDQUFDLENBQUE7UUFDeEUsQ0FBQyxDQUFDLENBQUE7SUFDSixDQUFDLENBQUMsQ0FBQTtJQUNGLFFBQVEsQ0FBQyxlQUF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