1 import { PLANS } from '@proton/payments';
2 import type { Subscription } from '@proton/shared/lib/interfaces';
3 import format from '@proton/shared/lib/subscription/format';
5 describe('Subscription Format', () => {
6 let subscription: Subscription;
7 let upcoming: Subscription;
11 ID: 'k2ou1ckjSusQvcOkMvMYo5_9tO93iG-5l0ycRA2wxWXkgR_3uW086eI8xit5qENSOes9nPbjIvUjkn8FdpZPrw==',
12 InvoiceID: 'EodtkjoLzxaZpTfWOMEEsfqQuKftg11lPzfDuMxQFnX2sagjugYRm8AZ7O6N3K9mJdbLN_t0dbEMWuhs-EhSLQ==',
15 PeriodStart: 1669038950,
16 PeriodEnd: 1671630950,
17 CreateTime: 1669038951,
26 ID: 'Wb4NAqmiuqoA7kCHE28y92bBFfN8jaYQCLxHRAB96yGj-bh9SxguXC48_WSU-fRUjdAr-lx95c6rFLplgXyXYA==',
33 MaxSpace: 16106127360,
51 ID: 'klHlWI9EqPULc0sWO_C36DM8eHJ1H1bzIo4EmX-HG_VbDfS67gMvCt_5mhHFwHh9n02aNoux8qj4bUZOaebRUg==',
52 InvoiceID: 'EodtkjoLzxaZpTfWOMEEsfqQuKftg11lPzfDuMxQFnX2sagjugYRm8AZ7O6N3K9mJdbLN_t0dbEMWuhs-EhSLQ==',
55 PeriodStart: 1671630950,
56 PeriodEnd: 1703166950,
57 CreateTime: 1669039317,
66 ID: 'Wb4NAqmiuqoA7kCHE28y92bBFfN8jaYQCLxHRAB96yGj-bh9SxguXC48_WSU-fRUjdAr-lx95c6rFLplgXyXYA==',
73 MaxSpace: 16106127360,
91 it('should add isManagedByMozilla property', () => {
92 const result = format(subscription, undefined);
93 expect(result.isManagedByMozilla).toBeDefined();
96 it('should not add upcoming property if it is not specified', () => {
97 const result = format(subscription, undefined);
98 expect(result.UpcomingSubscription).not.toBeDefined();
101 it('should add upcoming property if it is the second parameter', () => {
102 const result = format(subscription, upcoming);
103 expect(result.UpcomingSubscription).toBeDefined();