Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 31 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { RuleTester } from '../utils'; |
||
2 | |||
3 | const tester = new RuleTester('boolean'); |
||
4 | |||
5 | suite('Rules: boolean'); |
||
6 | |||
7 | test('Positive: boolean', function () { |
||
8 | tester.positive(true, true); |
||
9 | tester.positive(false, false); |
||
10 | }); |
||
11 | |||
12 | test('Positive: string', function () { |
||
13 | tester.positive('true', true); |
||
14 | tester.positive('false', false); |
||
15 | }); |
||
16 | |||
17 | test('Positive: number', function () { |
||
18 | tester.positive(1, true); |
||
19 | tester.positive(0, false); |
||
20 | }); |
||
21 | |||
22 | test('Positive: empty value', function () { |
||
23 | tester.positive(null, null); |
||
24 | tester.positive(undefined, undefined); |
||
25 | }); |
||
26 | |||
27 | test('Negative: bad formats', function () { |
||
28 | tester.negative({ object: 1 }, 'NOT_BOOLEAN', 'The value is not a boolean or could not be cast to a boolean'); |
||
29 | tester.negative('fkdsfdsfkds', 'NOT_BOOLEAN', 'The value is not a boolean or could not be cast to a boolean'); |
||
30 | tester.negative(2, 'NOT_BOOLEAN', 'The value is not a boolean or could not be cast to a boolean'); |
||
31 | }); |
||
32 |