1
- import chai from 'chai' ;
2
1
import capture from 'capture-console' ;
3
2
import Chance from 'chance' ;
3
+ import { expect } from 'chai' ;
4
4
5
5
import { setupNodeLogger , setupExpressLogger } from '..' ;
6
6
7
- const expect = chai . expect ;
8
7
const chance = new Chance ( ) ;
9
8
10
- describe ( 'strigo-node-logger' , function ( ) {
11
- describe ( '#setupNodeLogger()' , function ( ) {
12
- it ( 'should printout the configured severity level' , function ( ) {
13
- const log = setupNodeLogger ( null , 'warn' ) ;
9
+ describe ( 'strigo-node-logger' , ( ) => {
10
+ describe ( '#setupNodeLogger()' , ( ) => {
11
+ it ( 'should printout the configured severity level' , ( ) => {
12
+ const log = setupNodeLogger ( { level : 'warn' } ) ;
14
13
15
14
let printout ;
16
15
let stdout ;
@@ -32,8 +31,8 @@ describe('strigo-node-logger', function() {
32
31
expect ( stdout . indexOf ( 'info' ) ) . to . be . eq ( - 1 ) ;
33
32
} ) ;
34
33
35
- it ( 'should not write debug printout when set up with info level' , function ( ) {
36
- const log = setupNodeLogger ( 'prod' , 'info' ) ;
34
+ it ( 'should not write debug printout when set up with info level' , ( ) => {
35
+ const log = setupNodeLogger ( { env : 'prod' , level : 'info' } ) ;
37
36
38
37
const printout = chance . string ( ) ;
39
38
const stdout = capture . captureStdout ( ( ) => {
@@ -43,8 +42,8 @@ describe('strigo-node-logger', function() {
43
42
expect ( stdout . indexOf ( printout ) ) . to . be . eq ( - 1 ) ;
44
43
} ) ;
45
44
46
- it ( 'should not write debug printout when configured to info in runtime' , function ( ) {
47
- const log = setupNodeLogger ( 'prod' , 'debug' ) ;
45
+ it ( 'should not write debug printout when configured to info in runtime' , ( ) => {
46
+ const log = setupNodeLogger ( { env : 'prod' , level : 'debug' } ) ;
48
47
log . level = 'info' ;
49
48
50
49
const printout = chance . string ( ) ;
@@ -55,8 +54,8 @@ describe('strigo-node-logger', function() {
55
54
expect ( stdout . indexOf ( printout ) ) . to . be . eq ( - 1 ) ;
56
55
} ) ;
57
56
58
- it ( 'should allow setting up an express logger' , function ( ) {
59
- const { logger : log , loggerMiddleware : middleware } = setupExpressLogger ( 'prod' , 'info' ) ;
57
+ it ( 'should allow setting up an express logger' , ( ) => {
58
+ const { logger : log , loggerMiddleware : middleware } = setupExpressLogger ( { env : 'prod' , level : 'info' } ) ;
60
59
61
60
// Should be a function. This test can be better if we check for specific
62
61
// expressWinston attributes.
0 commit comments