Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
add: logger unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuanxin committed Jun 1, 2019
1 parent 1d7e5fd commit 73b96fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ function getPowerDate(): PowerDate {
*/
class Logger {

/**
* 颜色函数映射
*/
private _colors: any;

public constructor () {
Expand Down
7 changes: 7 additions & 0 deletions test/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ describe('utils.js', () => {
test('cpuNum getter', () => {
expect(utils.cpuNum).toBeGreaterThanOrEqual(4)
})

test('logger', () => {
const { logger } = utils
const levels = ['log', 'info', 'success', 'warn', 'error']
const valid = levels.reduce((pre, current) => pre && typeof logger[current] === 'function', true)
expect(valid).toBeTruthy()
})
})

0 comments on commit 73b96fc

Please sign in to comment.