tests/helpers/object/cleanUndefined.test.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 22
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
mnd 0
bc 0
fnc 3
dl 0
loc 22
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import { assert } from 'chai';
2
import { cleanUndefined } from '../../entry';
3
import { FunctionTester } from '../../utils';
4
5
const tester = new FunctionTester(cleanUndefined);
6
7
suite('object: cleanUndefined');
8
9
test('Positive: cleanUndefined @example', function () {
10
    tester.test({ x: { a: null, b: undefined }, c: 0 }, { x: { a: null }, c: 0 });
11
});
12
13
test('Positive: cleanUndefined on circullar structure', function () {
14
    const obj = { a: { b: null, c: undefined } };
15
16
    obj.a.obj = obj;
17
    assert.deepEqual(cleanUndefined(obj), { a: { b: null, obj } });
18
});
19
20
after(async function () {
21
    // console.log('after', this);
22
});
23
24