Skip to content

Commit 2b8cb96

Browse files
committed
Improve logger tests
1 parent 4197f09 commit 2b8cb96

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

tests/logger.test.js

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,36 @@ describe('AT / Logger', () => {
1919
error: fn('error'),
2020
});
2121

22-
it('created a logger', () => {
22+
it('creates a custom logger', () => {
2323
assert.strictEqual(typeof logger, 'object');
24+
assert.isOk(logger.debug);
25+
assert.isOk(logger.log);
26+
assert.isOk(logger.info);
27+
assert.isOk(logger.warn);
28+
assert.isOk(logger.error);
2429
});
2530

26-
it('fetches the test logger', () => {
31+
it('creates a default logger', () => {
32+
const logger2 = utils.createLogger({ name: 'test2' });
33+
assert.strictEqual(typeof logger2, 'object');
34+
assert.isOk(logger2.debug);
35+
assert.isOk(logger2.log);
36+
assert.isOk(logger2.info);
37+
assert.isOk(logger2.warn);
38+
assert.isOk(logger2.error);
39+
});
40+
41+
it('creates a fallback logger', () => {
42+
const logger3 = utils.getLogger(`logger-${Math.random()}`);
43+
assert.strictEqual(typeof logger3, 'object');
44+
assert.isOk(logger3.debug);
45+
assert.isOk(logger3.log);
46+
assert.isOk(logger3.info);
47+
assert.isOk(logger3.warn);
48+
assert.isOk(logger3.error);
49+
});
50+
51+
it('fetches a named logger', () => {
2752
assert.strictEqual(utils.getLogger('test'), logger);
2853
});
2954

@@ -63,4 +88,8 @@ describe('AT / Logger', () => {
6388
assert.strictEqual(logged, 'error:7.');
6489
});
6590

91+
it('has default "addon-tools" logger', () => {
92+
assert.isOk(utils.getLoggers()['addon-tools']);
93+
});
94+
6695
});

0 commit comments

Comments
 (0)