smartlog-destination-local/test/test.ts

77 lines
2.7 KiB
TypeScript
Raw Normal View History

2018-03-01 00:06:12 +00:00
import { tap, expect } from 'tapbundle';
import * as smartdelay from 'smartdelay';
2015-09-26 18:46:16 +00:00
2018-03-01 00:06:12 +00:00
import * as qenv from 'qenv';
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit');
2017-01-21 17:40:40 +00:00
2018-03-01 00:06:12 +00:00
import beautylog = require('../ts/index');
2017-04-21 21:38:51 +00:00
tap.test('.log(message) should print a blue Dir message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.log('beautylog.log(), with normal logText, without logType');
});
2017-04-21 21:38:51 +00:00
tap.test('.dir(message) should print a blue Dir message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.dir('beautylog.dir(), with normal logText, without logType');
});
2017-04-21 21:38:51 +00:00
tap.test('.error(message) should print a red error message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.error('beautylog.error(), with normal logText, without logType');
});
2017-04-21 21:38:51 +00:00
tap.test('.figlet should print nice fonts to console in yellow', async () => {
2018-03-01 00:06:12 +00:00
return beautylog.figlet('Async!', { font: 'Star Wars', color: 'orange' });
});
2017-04-21 21:38:51 +00:00
tap.test('.figletSync should print nice fonts to console in yellow', async () => {
2018-03-01 00:06:12 +00:00
beautylog.figletSync('Sync!', { font: 'Star Wars', color: 'blue' });
});
2017-04-21 21:38:51 +00:00
tap.test('.info(message) should display a purple info message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.info('beautylog.dir(), with normal logText, without logType');
});
2017-04-21 21:38:51 +00:00
tap.test('.logReduced(message) should only log two messages', async () => {
2018-03-01 00:06:12 +00:00
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 1');
beautylog.logReduced('Message 2');
beautylog.logReduced('Message 2');
});
2017-04-21 21:38:51 +00:00
tap.test('.ok(message) should display a green ok message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.ok('beautylog.ok() works!');
});
2017-04-21 21:38:51 +00:00
tap.test('.newLine(number) create specified amount of new lines', async () => {
2018-03-01 00:06:12 +00:00
beautylog.newLine(1);
});
2017-04-21 21:38:51 +00:00
tap.test('.ora(text,color) should display, update, and end a message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.ora.start('This is a test text', 'green');
await smartdelay.delayFor(2000);
beautylog.ora.text('updated text!');
await smartdelay.delayFor(2000);
beautylog.info('another log message that uses the normal log function');
await smartdelay.delayFor(2000);
beautylog.ora.endOk('Allright, ora works!');
});
2017-04-21 21:38:51 +00:00
tap.test('.ora(text,color) should display an error message when ended with error', async () => {
2018-03-01 00:06:12 +00:00
beautylog.ora.start('This is another test text', 'green');
await smartdelay.delayFor(2000);
beautylog.ora.endError('Allright, ora displays an error!');
});
2017-04-21 21:38:51 +00:00
tap.test('.success(message) should display an orange warn message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.success('beautylog.success() works!');
});
2017-04-21 21:38:51 +00:00
tap.test('.warn should display a orange warn message', async () => {
2018-03-01 00:06:12 +00:00
beautylog.warn('beautylog.warn() works!');
});
2017-04-21 21:38:51 +00:00
tap.test('.note should display a pink note', async () => {
2018-03-01 00:06:12 +00:00
beautylog.note('beautylog.note() works!');
});