Total Complexity | 3 |
Complexity/F | 1 |
Lines of Code | 29 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import TruthTable from '../../src/TruthTable.mjs'; |
||
2 | import InvalidInputError from '../../src/InvalidInputError'; |
||
3 | |||
4 | const ErrorTestCases = [ |
||
5 | { |
||
6 | description: 'test propositions with a null value', |
||
7 | propositions: null, |
||
8 | expectedError: 'propositions isnt a number', |
||
9 | }, |
||
10 | { |
||
11 | description: 'test propositions with a string', |
||
12 | propositions: 'not ok', |
||
13 | expectedError: 'propositions isnt a number', |
||
14 | }, |
||
15 | ]; |
||
16 | |||
17 | describe.each(ErrorTestCases)( |
||
18 | 'Test totalTrueInputs helper exception test', |
||
19 | ({ description, propositions, expectedError }) => { |
||
20 | it(description, () => { |
||
21 | function testWrongInput() { |
||
22 | TruthTable.create(propositions); |
||
23 | } |
||
24 | |||
25 | expect(testWrongInput).toThrowError(new Error(expectedError)); |
||
26 | expect(testWrongInput).toThrowError(InvalidInputError); |
||
27 | }); |
||
28 | } |
||
29 | ); |
||
30 |