Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / packages / shared / test / api / apiError.spec.ts
blob267a198a0a43fd6b75d4e382829ce91b55410eb4
1 import { isNotExistError } from '@proton/shared/lib/api/helpers/apiErrorHelper';
3 describe('isNotExistError', () => {
4     it('should be a not exist error', () => {
5         // Invalid id
6         const error1 = {
7             data: {
8                 Code: 2061,
9             },
10         };
12         // Message does not exists
13         const error2 = {
14             data: {
15                 Code: 2501,
16             },
17         };
19         // Conversation does not exists
20         const error3 = {
21             data: {
22                 Code: 20052,
23             },
24         };
26         expect(isNotExistError(error1)).toBeTruthy();
27         expect(isNotExistError(error2)).toBeTruthy();
28         expect(isNotExistError(error3)).toBeTruthy();
29     });
31     it('should not be a not exist error', () => {
32         const error1 = {};
34         const error2 = {
35             data: {
36                 Code: 'something else',
37             },
38         };
40         const error3 = {
41             data: {},
42         };
44         expect(isNotExistError(error1)).toBeFalsy();
45         expect(isNotExistError(error2)).toBeFalsy();
46         expect(isNotExistError(error3)).toBeFalsy();
47     });
48 });