Issues (7)

tests/package/test-data.test.js (1 issue)

1
import { createLogger, format } from 'winston';
2
import transport from '../entry';
3
import { verifyStdout, copy } from '../utils';
4
5
const LEVELS = {
6
    error   : 0,
7
    warn    : 1,
8
    info    : 2,
9
    notice  : 3,
10
    verbose : 4,
11
    debug   : 5
12
};
13
14
const logger = createLogger({
15
    level      : 'debug',
16
    levels     : LEVELS,
17
    format     : format.json(),
18
    transports : [ new transport({ sanitizer: o => o }) ]
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like transport should be capitalized.
Loading history...
19
});
20
21
suite('Data');
22
23
test('Positive: simple sentence', function () {
24
    const input = 'SIMPLE MESSAGE';
25
26
    verifyStdout(() => logger.notice(input), { message: 'SIMPLE MESSAGE' });
27
    verifyStdout(() => logger.log('notice', input), { message: 'SIMPLE MESSAGE' });
28
});
29
30
test('Positive: objects', function () {
31
    const input = { a: 'ABCD', b: 41, c: '?!' };
32
33
    verifyStdout(() => logger.notice(input), { message: input });
34
    verifyStdout(() => logger.log('notice', copy(input)), input);
35
});
36