smartlog-destination-local/test/test.ts

85 lines
2.9 KiB
TypeScript
Raw Normal View History

2017-04-21 21:38:51 +00:00
import { tap, expect } from 'tapbundle'
2017-08-28 11:14:35 +00:00
import * as smartdelay from 'smartdelay'
2015-09-26 18:46:16 +00:00
2017-01-21 17:40:40 +00:00
import * as qenv from 'qenv'
2017-01-22 10:42:04 +00:00
let testQenv = new qenv.Qenv(process.cwd(), process.cwd() + '/.nogit')
2017-01-21 17:40:40 +00:00
2017-08-28 11:14:35 +00:00
import * as beautyremote from 'beautyremote'
import beautylog = require('../ts/index')
2017-04-21 21:38:51 +00:00
tap.test('.registerRemote should accept a beautyremote', async () => {
let myRemote = new beautyremote.Loggly({
token: process.env.LOGGLY_TOKEN
2017-03-11 11:30:18 +00:00
})
2017-04-21 21:38:51 +00:00
beautylog.registerRemote(myRemote)
})
tap.test('.log(message) should print a blue Dir message', async () => {
beautylog.log('beautylog.log(), with normal logText, without logType')
})
tap.test('.dir(message) should print a blue Dir message', async () => {
beautylog.dir('beautylog.dir(), with normal logText, without logType')
})
tap.test('.error(message) should print a red error message', async () => {
beautylog.error('beautylog.error(), with normal logText, without logType')
})
tap.test('.figlet should print nice fonts to console in yellow', async () => {
return beautylog.figlet('Async!', { font: 'Star Wars', color: 'orange' })
})
tap.test('.figletSync should print nice fonts to console in yellow', async () => {
beautylog.figletSync('Sync!', { font: 'Star Wars', color: 'blue' })
})
tap.test('.info(message) should display a purple info message', async () => {
beautylog.info('beautylog.dir(), with normal logText, without logType')
})
tap.test('.logReduced(message) should only log two messages', async () => {
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 1')
beautylog.logReduced('Message 2')
beautylog.logReduced('Message 2')
})
tap.test('.ok(message) should display a green ok message', async () => {
beautylog.ok('beautylog.ok() works!')
})
tap.test('.newLine(number) create specified amount of new lines', async () => {
beautylog.newLine(1)
})
tap.test('.ora(text,color) should display, update, and end a message', async () => {
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!')
})
tap.test('.ora(text,color) should display an error message when ended with error', async () => {
beautylog.ora.start('This is another test text', 'green')
await smartdelay.delayFor(2000)
beautylog.ora.endError('Allright, ora displays an error!')
})
tap.test('.success(message) should display an orange warn message', async () => {
beautylog.success('beautylog.success() works!')
})
tap.test('.warn should display a orange warn message', async () => {
beautylog.warn('beautylog.warn() works!')
})
tap.test('.note should display a pink note', async () => {
beautylog.note('beautylog.note() works!')
2016-10-16 00:26:43 +00:00
})