tests/helpers/custom/searchFor.test.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 72
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 49
mnd 0
bc 0
fnc 3
dl 0
loc 72
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import { searchFor } from 'tests/entry';
2
import { FunctionTester } from '../../utils';
3
4
const tester = new FunctionTester(searchFor);
5
6
suite('Common: searchFor');
7
8
test('Positive: search string for matches @example', function () {
9
    tester.test('next hit nearby prepare', 'ar', [
10
        {
11
            'captures' : [],
12
            'full'     : 'ar',
13
            'index'    : 11,
14
            'input'    : 'next hit nearby prepare'
15
        },
16
        {
17
            'captures' : [],
18
            'full'     : 'ar',
19
            'index'    : 20,
20
            'input'    : 'next hit nearby prepare'
21
        }
22
23
    ]);
24
25
    tester.test('a b 3 c 1 d 2 e f', /\d/, [
26
        {
27
            'captures' : [],
28
            'full'     : '3',
29
            'index'    : 4,
30
            'input'    : 'a b 3 c 1 d 2 e f'
31
        },
32
        {
33
            'captures' : [],
34
            'full'     : '1',
35
            'index'    : 8,
36
            'input'    : 'a b 3 c 1 d 2 e f'
37
        },
38
        {
39
            'captures' : [],
40
            'full'     : '2',
41
            'index'    : 12,
42
            'input'    : 'a b 3 c 1 d 2 e f'
43
        }
44
    ]);
45
46
    tester.test('discover WON present consist hand', /\w*(on)\w*/i, [
47
        {
48
            'captures' : [
49
                'ON'
50
            ],
51
            'full'  : 'WON',
52
            'index' : 9,
53
            'input' : 'discover WON present consist hand'
54
        },
55
        {
56
            'captures' : [
57
                'on'
58
            ],
59
            'full'  : 'consist',
60
            'index' : 21,
61
            'input' : 'discover WON present consist hand'
62
        }
63
    ]);
64
});
65
66
test('Negative: no occurrences found @example', function () {
67
    tester.test('southern bell drink fresh list', /truth/g, []);
68
});
69
70
after(async function () {
71
    // console.log('after', this);
72
});
73
74