Total Complexity | 4 |
Complexity/F | 1 |
Lines of Code | 23 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { assert } from 'chai'; |
||
2 | import Test from '../Test'; |
||
3 | import { checkError, load } from '../utils'; |
||
4 | |||
5 | const factory = new Test(); |
||
6 | const api = factory.createAPI(); |
||
7 | const API_ERROR = load('Error').default; |
||
8 | |||
9 | suite('Api Errors'); |
||
10 | |||
11 | before(function () { |
||
12 | factory.mockAPI(); |
||
13 | }); |
||
14 | |||
15 | test('Negative: unknownError', async function () { |
||
16 | await checkError(api.put('/request_4/unknownError'), 'Error', 'unknownError occured'); |
||
17 | }); |
||
18 | |||
19 | test('Negative: apiError with empty data', async function () { |
||
20 | await checkError(api.put('/request_4/emptyError'), 'API_ERROR', 'Error: Request failed with status code 401'); |
||
21 | }); |
||
22 | |||
23 | test('Negative: Error idempotency', async function () { |
||
24 | const err = await api.put('/request_4/emptyError').catch(error => error); |
||
37 |