Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / packages / sieve / src / fromSieve / fromTree.test.ts
blobb2bbbf0e92f7e68ff7b034e17a25edae6519a212
1 import folder from '../../fixtures/folder';
2 import v1StartsEndsTest from '../../fixtures/v1StartsEndsTest';
3 import v2 from '../../fixtures/v2';
4 import v2Attachments from '../../fixtures/v2Attachments';
5 import v2Complex from '../../fixtures/v2Complex';
6 import v2EscapeVariables from '../../fixtures/v2EscapeVariables';
7 import v2From from '../../fixtures/v2From';
8 import v2InvalidStructure from '../../fixtures/v2InvalidStructure';
9 import v2SpamOnly from '../../fixtures/v2SpamOnly';
10 import v2StartsEndsTest from '../../fixtures/v2StartsEndsTest';
11 import v2Vacation from '../../fixtures/v2Vacation';
12 import v2VacationDouble from '../../fixtures/v2VacationDouble';
13 import v2VariableManyConditionsComplex from '../../fixtures/v2VariableManyConditionsComplex';
14 import { fromSieveTree } from './fromSieveTree';
16 describe('To Tree testing', () => {
17     it('fromSieveTree - Should match simple test', () => {
18         const { simple, tree } = folder;
19         const generated = fromSieveTree(tree);
20         expect(generated).toEqual(simple);
21     });
23     it('fromSieveTree - Should match on v2', () => {
24         const { simple, tree } = v2;
25         const generated = fromSieveTree(tree);
26         expect(generated).toEqual(simple);
27     });
29     it('fromSieveTree - Should match on v1 with tree', () => {
30         const { simple, tree } = v1StartsEndsTest;
31         const generated = fromSieveTree(tree);
32         expect(generated).toEqual(simple);
33     });
35     it('fromSieveTree - Should match on v2 with tree', () => {
36         const { simple, tree } = v2StartsEndsTest;
37         const generated = fromSieveTree(tree);
38         expect(generated).toEqual(simple);
39     });
41     it('fromSieveTree - Should match on v2 with attachments', () => {
42         const { simple, tree } = v2Attachments;
43         const generated = fromSieveTree(tree);
44         expect(generated).toEqual(simple);
45     });
47     it('fromSieveTree - Should match on v2 with vacation', () => {
48         const { simple, tree } = v2Vacation;
49         const generated = fromSieveTree(tree);
50         expect(generated).toEqual(simple);
51     });
53     it('fromSieveTree - Should match on v2 with from', () => {
54         const { simple, tree } = v2From;
55         const generated = fromSieveTree(tree);
56         expect(generated).toEqual(simple);
57     });
59     it('fromSieveTree - Should match on v2 with complex', () => {
60         const { simple, tree } = v2Complex;
61         const generated = fromSieveTree(tree);
62         expect(generated).toEqual(simple);
63     });
65     it('fromSieveTree - Should match on v2 with vacation double', () => {
66         const { simple, tree } = v2VacationDouble;
67         const generated = fromSieveTree(tree);
68         expect(generated).toEqual(simple);
69     });
71     it('fromSieveTree - Should match on v2 with complex with many conditions and variables', () => {
72         const { simple, tree } = v2VariableManyConditionsComplex;
73         const generated = fromSieveTree(tree);
74         expect(generated).toEqual(simple);
75     });
77     it('fromSieveTree - Should match on v2 with escape variables', () => {
78         const { simple, tree } = v2EscapeVariables;
79         const generated = fromSieveTree(tree);
80         expect(generated).toEqual(simple);
81     });
83     it('fromSieveTree - Should error on invalid tree', () => {
84         const { simple, tree } = v2InvalidStructure;
85         const generated = fromSieveTree(tree);
86         expect(generated).toEqual(simple);
87     });
89     it('fromSieveTree - Should match on v2 with spam only folder', () => {
90         const { simple, tree } = v2SpamOnly;
91         const generated = fromSieveTree(tree);
92         expect(generated).toEqual(simple);
93     });
94 });