smartlog-destination-local/test/test.ts

105 lines
3.8 KiB
TypeScript
Raw Permalink Normal View History

2016-10-16 00:26:43 +00:00
import 'typings-test'
import beautylog = require('../dist/index')
2017-01-22 10:42:04 +00:00
import * as beautyremote from 'beautyremote'
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
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(){
beautylog.log('beautylog.log(), with normal logText, without logType')
2016-07-23 23:17:38 +00:00
})
})
2016-10-16 00:26:43 +00:00
describe('.dir(message)',function(){
it('should print a blue Dir message',function(){
beautylog.dir('beautylog.dir(), with normal logText, without logType')
2016-02-02 15:49:16 +00:00
})
})
2016-10-16 00:26:43 +00:00
describe('.error(message)',function(){
it('should print a red error message',function(){
beautylog.error('beautylog.error(), with normal logText, without logType')
2016-05-13 23:18:44 +00:00
})
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-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'})
})
})
describe('.info(message)',function(){
it('should display a purple info message',function(){
beautylog.info('beautylog.dir(), with normal logText, without logType')
2016-05-13 23:18:44 +00:00
})
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')
})
})
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-10-16 00:26:43 +00:00
})
})
describe('.newLine(number)',function(){
it('create specified amount of new lines',function(){
beautylog.newLine(1)
2016-06-16 21:57:49 +00:00
})
})
2016-10-16 00:26:43 +00:00
describe('.ora(text,color)',function(){
it('should display, update, and end a message',function(done){
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-10-16 00:26:43 +00:00
done()
},2000)
2016-05-13 23:18:44 +00:00
},2000)
2016-10-16 00:26:43 +00:00
})
it('should display an error message when ended with error',function(done){
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-10-16 00:26:43 +00:00
done()
2016-05-13 23:18:44 +00:00
},2000)
2016-02-02 15:49:16 +00:00
})
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-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-10-16 00:26:43 +00:00
})
})
})