UNPKG

1.54 kBJavaScriptView Raw
1var assert = require ('assert');
2
3describe ('logger', function(){
4
5 describe('standalone', function(){
6 var logger = require ('../lib/logger')();
7
8 it('should contain a log method', function(done){
9 assert.equal('function', typeof logger.log);
10 done();
11 });
12
13 it('should contain a warn method', function(done){
14 assert.equal('function', typeof logger.warn);
15 done();
16 });
17
18 it('should contain an error method', function(done){
19 assert.equal('function', typeof logger.error);
20 done();
21 });
22
23 });
24
25 describe('job logger', function(){
26 var jobMock = {};
27 var ioMock = {};
28
29 var logger = require ('../lib/logger')(jobMock, ioMock);
30
31 it('should contain a log method', function(done){
32 assert.equal('function', typeof logger.log);
33 done();
34 });
35
36 it('should contain a warn method', function(done){
37 assert.equal('function', typeof logger.warn);
38 done();
39 });
40
41 it('should contain an error method', function(done){
42 assert.equal('function', typeof logger.error);
43 done();
44 });
45
46 describe('io dependency', function(){
47 it('should should emit to io sink', function(done){
48 ioMock = {
49 of: function (){
50 return {
51 emit: function(){
52 done();
53 }
54 };
55 }
56 };
57
58 logger = require ('../lib/logger')(jobMock, ioMock);
59 logger.log('hola');
60 });
61 });
62 });
63});
\No newline at end of file