Passed
Push — master ( 33c5b5...675f6f )
by Dmytro
01:43
created

tests/utils/jsdocUtils.test.js   A

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 43
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 28
mnd 0
bc 0
fnc 4
dl 0
loc 43
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import { assert } from 'chai';
2
import { load } from '../utils';
3
import toArrayAST from '../files/jsdoc/function-toArray.ast.json';
4
import toArrayJSDOC from '../files/jsdoc/function-toArray.jsdoc.json';
5
import uniqueIdFilterAST from '../files/jsdoc/const-uniqueIdFilter.ast.json';
6
import uniqueIdFilterJSDOC from '../files/jsdoc/const-uniqueIdFilter.jsdoc.json';
7
import fillAST from '../files/jsdoc/todo-fill.ast.json';
8
import fillJSDOC from '../files/jsdoc/todo-fill.jsdoc.json';
9
import unparsableAST from '../files/jsdoc/unparsable.ast.json';
10
11
const { extractJSDOC } = load('utils/jsdocUtils');
12
13
suite('jsdocUtils');
14
15
test('Positive: jsdoc on function', async function () {
16
    assert.deepEqual(
17
        await extractJSDOC(toArrayAST),
18
        toArrayJSDOC
19
    );
20
});
21
22
test('Positive: jsdoc on constant', async function () {
23
    assert.deepEqual(
24
        await extractJSDOC(uniqueIdFilterAST),
25
        uniqueIdFilterJSDOC
26
    );
27
});
28
29
test('Positive: jsdoc on todo comment', async function () {
30
    const jsdoc = await extractJSDOC(fillAST);
31
32
    assert.deepEqual(
33
        jsdoc,
34
        fillJSDOC
35
    );
36
});
37
38
test('Negative: ignore unparsable types', async function () {
39
    assert.deepEqual(
40
        await extractJSDOC(unparsableAST),
41
        []
42
    );
43
});
44