Total Complexity | 4 |
Complexity/F | 1 |
Lines of Code | 30 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { assert } from 'chai'; |
||
2 | import { testFunction } from '../utils'; |
||
3 | import { |
||
4 | cleanUndefined, |
||
5 | mergeConfigs |
||
6 | } from '../../src/utils'; |
||
7 | |||
8 | suite('Utils'); |
||
9 | |||
10 | test('cleanUndefined', function () { |
||
11 | const verify = testFunction(cleanUndefined); |
||
12 | |||
13 | verify({}, {}); |
||
14 | verify({ a: 1, b: 2 }, { a: 1, b: 2 }); |
||
15 | verify({ a: null }, { a: null }); |
||
16 | verify({ a: 1, b: 2, c: null, d: undefined }, { a: 1, b: 2, c: null }); |
||
17 | }); |
||
18 | |||
19 | test('mergeConfigs', function () { |
||
20 | const config = mergeConfigs( |
||
21 | [ { logger: console, contextSanitizer: () => 1 } ], |
||
22 | [], |
||
23 | [ { level: 'info', contextSanitizer: () => 2 } ] |
||
24 | ); |
||
25 | |||
26 | assert.isObject(config); |
||
27 | |||
28 | assert.equal(config.level, 'info'); |
||
29 | assert.equal(config.contextSanitizer(), 1); |
||
30 | }); |
||
31 |