tests/rules/string.test.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 23
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
mnd 0
bc 0
fnc 3
dl 0
loc 23
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import { RuleTester } from '../utils';
2
3
const tester = new RuleTester('string');
4
5
suite('Rules: string');
6
7
test('Positive: string', function () {
8
    tester.positive('5', '5');
9
    tester.positive('[email protected]', '[email protected]');
10
});
11
12
test('Positive: empty value', function () {
13
    tester.positive(null, null);
14
    tester.positive(undefined, undefined);
15
});
16
17
test('Negative: bad formats', function () {
18
    tester.negative(4, 'NOT_STRING', 'The value is not a string');
19
    tester.negative({ object: 1 }, 'NOT_STRING', 'The value is not a string');
20
    tester.negative(false, 'NOT_STRING', 'The value is not a string');
21
    tester.negative(true, 'NOT_STRING', 'The value is not a string');
22
    tester.negative([ 'fkdsfdsfkds' ], 'NOT_STRING', 'The value is not a string');
23
});
24