Skip to content

Commit

Permalink
Improve logger tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raub committed Nov 2, 2024
1 parent 4197f09 commit 2b8cb96
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions tests/logger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,36 @@ describe('AT / Logger', () => {
error: fn('error'),
});

it('created a logger', () => {
it('creates a custom logger', () => {
assert.strictEqual(typeof logger, 'object');
assert.isOk(logger.debug);
assert.isOk(logger.log);
assert.isOk(logger.info);
assert.isOk(logger.warn);
assert.isOk(logger.error);
});

it('fetches the test logger', () => {
it('creates a default logger', () => {
const logger2 = utils.createLogger({ name: 'test2' });
assert.strictEqual(typeof logger2, 'object');
assert.isOk(logger2.debug);
assert.isOk(logger2.log);
assert.isOk(logger2.info);
assert.isOk(logger2.warn);
assert.isOk(logger2.error);
});

it('creates a fallback logger', () => {
const logger3 = utils.getLogger(`logger-${Math.random()}`);
assert.strictEqual(typeof logger3, 'object');
assert.isOk(logger3.debug);
assert.isOk(logger3.log);
assert.isOk(logger3.info);
assert.isOk(logger3.warn);
assert.isOk(logger3.error);
});

it('fetches a named logger', () => {
assert.strictEqual(utils.getLogger('test'), logger);
});

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

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

});

0 comments on commit 2b8cb96

Please sign in to comment.