@forklaunch/implementation-billing-base 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__test__/schemaEquality.test.d.ts +1 -1
- package/lib/__test__/schemaEquality.test.js +146 -305
- package/lib/eject/domain/schemas/billingPortal.schema.ts +7 -1
- package/lib/jest.config.d.ts +1 -1
- package/lib/jest.config.js +16 -16
- package/lib/schemas/billingPortal.schema.d.ts +34 -107
- package/lib/schemas/billingPortal.schema.js +1 -4
- package/lib/schemas/checkoutSession.schema.d.ts +54 -169
- package/lib/schemas/checkoutSession.schema.js +1 -4
- package/lib/schemas/index.d.ts +1 -1
- package/lib/schemas/paymentLink.schema.d.ts +64 -210
- package/lib/schemas/paymentLink.schema.js +1 -4
- package/lib/schemas/plan.schema.d.ts +76 -326
- package/lib/schemas/plan.schema.js +1 -4
- package/lib/schemas/subscription.schema.d.ts +88 -364
- package/lib/schemas/subscription.schema.js +1 -4
- package/lib/schemas/typebox/billingPortal.schema.d.ts +38 -172
- package/lib/schemas/typebox/billingPortal.schema.js +17 -23
- package/lib/schemas/typebox/checkoutSession.schema.d.ts +55 -197
- package/lib/schemas/typebox/checkoutSession.schema.js +13 -25
- package/lib/schemas/typebox/paymentLink.schema.d.ts +65 -275
- package/lib/schemas/typebox/paymentLink.schema.js +15 -27
- package/lib/schemas/typebox/plan.schema.d.ts +77 -409
- package/lib/schemas/typebox/plan.schema.js +17 -31
- package/lib/schemas/typebox/subscription.schema.d.ts +89 -481
- package/lib/schemas/typebox/subscription.schema.js +19 -31
- package/lib/schemas/zod/billingPortal.schema.d.ts +38 -42
- package/lib/schemas/zod/billingPortal.schema.js +17 -23
- package/lib/schemas/zod/checkoutSession.schema.d.ts +55 -107
- package/lib/schemas/zod/checkoutSession.schema.js +13 -25
- package/lib/schemas/zod/paymentLink.schema.d.ts +65 -99
- package/lib/schemas/zod/paymentLink.schema.js +15 -27
- package/lib/schemas/zod/plan.schema.d.ts +77 -177
- package/lib/schemas/zod/plan.schema.js +17 -31
- package/lib/schemas/zod/subscription.schema.d.ts +89 -181
- package/lib/schemas/zod/subscription.schema.js +19 -31
- package/lib/services/billingPortal.service.d.ts +28 -77
- package/lib/services/billingPortal.service.js +45 -64
- package/lib/services/checkoutSession.service.d.ts +29 -77
- package/lib/services/checkoutSession.service.js +43 -54
- package/lib/services/index.d.ts +1 -1
- package/lib/services/paymentLink.service.d.ts +32 -82
- package/lib/services/paymentLink.service.js +66 -84
- package/lib/services/plan.service.d.ts +26 -73
- package/lib/services/plan.service.js +40 -45
- package/lib/services/subscription.service.d.ts +44 -136
- package/lib/services/subscription.service.js +88 -111
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/vitest.config.d.ts +2 -2
- package/lib/vitest.config.js +4 -4
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=schemaEquality.test.d.ts.map
|
|
2
|
+
//# sourceMappingURL=schemaEquality.test.d.ts.map
|
|
@@ -1,255 +1,135 @@
|
|
|
1
1
|
import { isTrue } from '@forklaunch/common';
|
|
2
2
|
import { DummyEnum, testSchemaEquality } from '@forklaunch/core/test';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '../schemas/typebox/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from '../schemas/
|
|
13
|
-
import {
|
|
14
|
-
CreatePaymentLinkSchema as TypeboxCreatePaymentLinkSchema,
|
|
15
|
-
PaymentLinkSchema as TypeboxPaymentLinkSchema,
|
|
16
|
-
UpdatePaymentLinkSchema as TypeboxUpdatePaymentLinkSchema
|
|
17
|
-
} from '../schemas/typebox/paymentLink.schema';
|
|
18
|
-
import {
|
|
19
|
-
CreatePlanSchema as TypeboxCreatePlanSchema,
|
|
20
|
-
PlanSchema as TypeboxPlanSchema,
|
|
21
|
-
UpdatePlanSchema as TypeboxUpdatePlanSchema
|
|
22
|
-
} from '../schemas/typebox/plan.schema';
|
|
23
|
-
import {
|
|
24
|
-
CreateSubscriptionSchema as TypeboxCreateSubscriptionSchema,
|
|
25
|
-
SubscriptionSchema as TypeboxSubscriptionSchema,
|
|
26
|
-
UpdateSubscriptionSchema as TypeboxUpdateSubscriptionSchema
|
|
27
|
-
} from '../schemas/typebox/subscription.schema';
|
|
28
|
-
import {
|
|
29
|
-
BillingPortalSchema as ZodBillingPortalSchema,
|
|
30
|
-
CreateBillingPortalSchema as ZodCreateBillingPortalSchema,
|
|
31
|
-
UpdateBillingPortalSchema as ZodUpdateBillingPortalSchema
|
|
32
|
-
} from '../schemas/zod/billingPortal.schema';
|
|
33
|
-
import {
|
|
34
|
-
CheckoutSessionSchema as ZodCheckoutSessionSchema,
|
|
35
|
-
CreateCheckoutSessionSchema as ZodCreateCheckoutSessionSchema,
|
|
36
|
-
UpdateCheckoutSessionSchema as ZodUpdateCheckoutSessionSchema
|
|
37
|
-
} from '../schemas/zod/checkoutSession.schema';
|
|
38
|
-
import {
|
|
39
|
-
CreatePaymentLinkSchema as ZodCreatePaymentLinkSchema,
|
|
40
|
-
PaymentLinkSchema as ZodPaymentLinkSchema,
|
|
41
|
-
UpdatePaymentLinkSchema as ZodUpdatePaymentLinkSchema
|
|
42
|
-
} from '../schemas/zod/paymentLink.schema';
|
|
43
|
-
import {
|
|
44
|
-
CreatePlanSchema as ZodCreatePlanSchema,
|
|
45
|
-
PlanSchema as ZodPlanSchema,
|
|
46
|
-
UpdatePlanSchema as ZodUpdatePlanSchema
|
|
47
|
-
} from '../schemas/zod/plan.schema';
|
|
48
|
-
import {
|
|
49
|
-
CreateSubscriptionSchema as ZodCreateSubscriptionSchema,
|
|
50
|
-
SubscriptionSchema as ZodSubscriptionSchema,
|
|
51
|
-
UpdateSubscriptionSchema as ZodUpdateSubscriptionSchema
|
|
52
|
-
} from '../schemas/zod/subscription.schema';
|
|
3
|
+
import { BillingPortalSchema as TypeboxBillingPortalSchema, CreateBillingPortalSchema as TypeboxCreateBillingPortalSchema, UpdateBillingPortalSchema as TypeboxUpdateBillingPortalSchema } from '../schemas/typebox/billingPortal.schema';
|
|
4
|
+
import { CheckoutSessionSchema as TypeboxCheckoutSessionSchema, CreateCheckoutSessionSchema as TypeboxCreateCheckoutSessionSchema, UpdateCheckoutSessionSchema as TypeboxUpdateCheckoutSessionSchema } from '../schemas/typebox/checkoutSession.schema';
|
|
5
|
+
import { CreatePaymentLinkSchema as TypeboxCreatePaymentLinkSchema, PaymentLinkSchema as TypeboxPaymentLinkSchema, UpdatePaymentLinkSchema as TypeboxUpdatePaymentLinkSchema } from '../schemas/typebox/paymentLink.schema';
|
|
6
|
+
import { CreatePlanSchema as TypeboxCreatePlanSchema, PlanSchema as TypeboxPlanSchema, UpdatePlanSchema as TypeboxUpdatePlanSchema } from '../schemas/typebox/plan.schema';
|
|
7
|
+
import { CreateSubscriptionSchema as TypeboxCreateSubscriptionSchema, SubscriptionSchema as TypeboxSubscriptionSchema, UpdateSubscriptionSchema as TypeboxUpdateSubscriptionSchema } from '../schemas/typebox/subscription.schema';
|
|
8
|
+
import { BillingPortalSchema as ZodBillingPortalSchema, CreateBillingPortalSchema as ZodCreateBillingPortalSchema, UpdateBillingPortalSchema as ZodUpdateBillingPortalSchema } from '../schemas/zod/billingPortal.schema';
|
|
9
|
+
import { CheckoutSessionSchema as ZodCheckoutSessionSchema, CreateCheckoutSessionSchema as ZodCreateCheckoutSessionSchema, UpdateCheckoutSessionSchema as ZodUpdateCheckoutSessionSchema } from '../schemas/zod/checkoutSession.schema';
|
|
10
|
+
import { CreatePaymentLinkSchema as ZodCreatePaymentLinkSchema, PaymentLinkSchema as ZodPaymentLinkSchema, UpdatePaymentLinkSchema as ZodUpdatePaymentLinkSchema } from '../schemas/zod/paymentLink.schema';
|
|
11
|
+
import { CreatePlanSchema as ZodCreatePlanSchema, PlanSchema as ZodPlanSchema, UpdatePlanSchema as ZodUpdatePlanSchema } from '../schemas/zod/plan.schema';
|
|
12
|
+
import { CreateSubscriptionSchema as ZodCreateSubscriptionSchema, SubscriptionSchema as ZodSubscriptionSchema, UpdateSubscriptionSchema as ZodUpdateSubscriptionSchema } from '../schemas/zod/subscription.schema';
|
|
53
13
|
const zodUpdateBillingPortalSchema = ZodUpdateBillingPortalSchema({
|
|
54
|
-
|
|
14
|
+
uuidId: false
|
|
55
15
|
});
|
|
56
16
|
const typeboxUpdateBillingPortalSchema = TypeboxUpdateBillingPortalSchema({
|
|
57
|
-
|
|
17
|
+
uuidId: false
|
|
58
18
|
});
|
|
59
19
|
const zodBillingPortalSchema = ZodBillingPortalSchema({ uuidId: false });
|
|
60
20
|
const typeboxBillingPortalSchema = TypeboxBillingPortalSchema({
|
|
61
|
-
|
|
21
|
+
uuidId: false
|
|
62
22
|
});
|
|
63
|
-
const zodCreateCheckoutSessionSchema =
|
|
64
|
-
|
|
65
|
-
const typeboxCreateCheckoutSessionSchema =
|
|
66
|
-
TypeboxCreateCheckoutSessionSchema(DummyEnum);
|
|
23
|
+
const zodCreateCheckoutSessionSchema = ZodCreateCheckoutSessionSchema(DummyEnum);
|
|
24
|
+
const typeboxCreateCheckoutSessionSchema = TypeboxCreateCheckoutSessionSchema(DummyEnum);
|
|
67
25
|
const zodUpdateCheckoutSessionSchema = ZodUpdateCheckoutSessionSchema({
|
|
68
|
-
|
|
26
|
+
uuidId: false
|
|
69
27
|
})(DummyEnum);
|
|
70
28
|
const typeboxUpdateCheckoutSessionSchema = TypeboxUpdateCheckoutSessionSchema({
|
|
71
|
-
|
|
29
|
+
uuidId: false
|
|
72
30
|
})(DummyEnum);
|
|
73
|
-
const zodCheckoutSessionSchema = ZodCheckoutSessionSchema({ uuidId: true })(
|
|
74
|
-
DummyEnum
|
|
75
|
-
);
|
|
31
|
+
const zodCheckoutSessionSchema = ZodCheckoutSessionSchema({ uuidId: true })(DummyEnum);
|
|
76
32
|
const typeboxCheckoutSessionSchema = TypeboxCheckoutSessionSchema({
|
|
77
|
-
|
|
33
|
+
uuidId: true
|
|
78
34
|
})(DummyEnum);
|
|
79
35
|
const zodCreatePaymentLinkSchema = ZodCreatePaymentLinkSchema(DummyEnum);
|
|
80
|
-
const typeboxCreatePaymentLinkSchema =
|
|
81
|
-
TypeboxCreatePaymentLinkSchema(DummyEnum);
|
|
36
|
+
const typeboxCreatePaymentLinkSchema = TypeboxCreatePaymentLinkSchema(DummyEnum);
|
|
82
37
|
const zodUpdatePaymentLinkSchema = ZodUpdatePaymentLinkSchema({
|
|
83
|
-
|
|
38
|
+
uuidId: false
|
|
84
39
|
})(DummyEnum);
|
|
85
40
|
const typeboxUpdatePaymentLinkSchema = TypeboxUpdatePaymentLinkSchema({
|
|
86
|
-
|
|
41
|
+
uuidId: false
|
|
87
42
|
})(DummyEnum);
|
|
88
43
|
const zodPaymentLinkSchema = ZodPaymentLinkSchema({ uuidId: true })(DummyEnum);
|
|
89
44
|
const typeboxPaymentLinkSchema = TypeboxPaymentLinkSchema({
|
|
90
|
-
|
|
45
|
+
uuidId: false
|
|
91
46
|
})(DummyEnum);
|
|
92
47
|
const zodCreatePlanSchema = ZodCreatePlanSchema(DummyEnum, DummyEnum);
|
|
93
48
|
const typeboxCreatePlanSchema = TypeboxCreatePlanSchema(DummyEnum, DummyEnum);
|
|
94
|
-
const zodUpdatePlanSchema = ZodUpdatePlanSchema({ uuidId: false })(
|
|
95
|
-
|
|
96
|
-
DummyEnum
|
|
97
|
-
);
|
|
98
|
-
const typeboxUpdatePlanSchema = TypeboxUpdatePlanSchema({ uuidId: false })(
|
|
99
|
-
DummyEnum,
|
|
100
|
-
DummyEnum
|
|
101
|
-
);
|
|
49
|
+
const zodUpdatePlanSchema = ZodUpdatePlanSchema({ uuidId: false })(DummyEnum, DummyEnum);
|
|
50
|
+
const typeboxUpdatePlanSchema = TypeboxUpdatePlanSchema({ uuidId: false })(DummyEnum, DummyEnum);
|
|
102
51
|
const zodPlanSchema = ZodPlanSchema({ uuidId: true })(DummyEnum, DummyEnum);
|
|
103
|
-
const typeboxPlanSchema = TypeboxPlanSchema({ uuidId: true })(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
);
|
|
107
|
-
const zodCreateSubscriptionSchema = ZodCreateSubscriptionSchema(
|
|
108
|
-
DummyEnum,
|
|
109
|
-
DummyEnum
|
|
110
|
-
);
|
|
111
|
-
const typeboxCreateSubscriptionSchema = TypeboxCreateSubscriptionSchema(
|
|
112
|
-
DummyEnum,
|
|
113
|
-
DummyEnum
|
|
114
|
-
);
|
|
52
|
+
const typeboxPlanSchema = TypeboxPlanSchema({ uuidId: true })(DummyEnum, DummyEnum);
|
|
53
|
+
const zodCreateSubscriptionSchema = ZodCreateSubscriptionSchema(DummyEnum, DummyEnum);
|
|
54
|
+
const typeboxCreateSubscriptionSchema = TypeboxCreateSubscriptionSchema(DummyEnum, DummyEnum);
|
|
115
55
|
const zodUpdateSubscriptionSchema = ZodUpdateSubscriptionSchema({
|
|
116
|
-
|
|
56
|
+
uuidId: false
|
|
117
57
|
})(DummyEnum, DummyEnum);
|
|
118
58
|
const typeboxUpdateSubscriptionSchema = TypeboxUpdateSubscriptionSchema({
|
|
119
|
-
|
|
59
|
+
uuidId: false
|
|
120
60
|
})(DummyEnum, DummyEnum);
|
|
121
|
-
const zodSubscriptionSchema = ZodSubscriptionSchema({ uuidId: true })(
|
|
122
|
-
DummyEnum,
|
|
123
|
-
DummyEnum
|
|
124
|
-
);
|
|
61
|
+
const zodSubscriptionSchema = ZodSubscriptionSchema({ uuidId: true })(DummyEnum, DummyEnum);
|
|
125
62
|
const typeboxSubscriptionSchema = TypeboxSubscriptionSchema({
|
|
126
|
-
|
|
63
|
+
uuidId: true
|
|
127
64
|
})(DummyEnum, DummyEnum);
|
|
128
65
|
describe('schema equality', () => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
isTrue(
|
|
132
|
-
testSchemaEquality(
|
|
133
|
-
ZodCreateBillingPortalSchema,
|
|
134
|
-
TypeboxCreateBillingPortalSchema,
|
|
135
|
-
{
|
|
66
|
+
it('should be equal for billing portal', () => {
|
|
67
|
+
expect(isTrue(testSchemaEquality(ZodCreateBillingPortalSchema, TypeboxCreateBillingPortalSchema, {
|
|
136
68
|
customerId: 'test',
|
|
137
69
|
uri: 'https://example.com',
|
|
138
70
|
expiresAt: new Date()
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
)
|
|
142
|
-
).toBeTruthy();
|
|
143
|
-
expect(
|
|
144
|
-
isTrue(
|
|
145
|
-
testSchemaEquality(
|
|
146
|
-
zodUpdateBillingPortalSchema,
|
|
147
|
-
typeboxUpdateBillingPortalSchema,
|
|
148
|
-
{
|
|
71
|
+
}))).toBeTruthy();
|
|
72
|
+
expect(isTrue(testSchemaEquality(zodUpdateBillingPortalSchema, typeboxUpdateBillingPortalSchema, {
|
|
149
73
|
id: 'test',
|
|
150
74
|
uri: 'https://example.com',
|
|
151
75
|
expiresAt: new Date()
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
})
|
|
167
|
-
)
|
|
168
|
-
).toBeTruthy();
|
|
169
|
-
});
|
|
170
|
-
it('should be equal for checkout session', () => {
|
|
171
|
-
expect(
|
|
172
|
-
isTrue(
|
|
173
|
-
testSchemaEquality(
|
|
174
|
-
zodCreateCheckoutSessionSchema,
|
|
175
|
-
typeboxCreateCheckoutSessionSchema,
|
|
176
|
-
{
|
|
76
|
+
}))).toBeTruthy();
|
|
77
|
+
expect(isTrue(testSchemaEquality(zodBillingPortalSchema, typeboxBillingPortalSchema, {
|
|
78
|
+
id: 'test',
|
|
79
|
+
customerId: 'test',
|
|
80
|
+
uri: 'https://example.com',
|
|
81
|
+
expiresAt: new Date(),
|
|
82
|
+
extraFields: {
|
|
83
|
+
test: 'test'
|
|
84
|
+
}
|
|
85
|
+
}))).toBeTruthy();
|
|
86
|
+
});
|
|
87
|
+
it('should be equal for checkout session', () => {
|
|
88
|
+
expect(isTrue(testSchemaEquality(zodCreateCheckoutSessionSchema, typeboxCreateCheckoutSessionSchema, {
|
|
177
89
|
customerId: 'test',
|
|
178
90
|
paymentMethods: [DummyEnum.A, DummyEnum.B],
|
|
179
91
|
successRedirectUri: 'https://example.com',
|
|
180
92
|
cancelRedirectUri: 'https://example.com',
|
|
181
93
|
extraFields: {
|
|
182
|
-
|
|
94
|
+
test: 'test'
|
|
183
95
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
)
|
|
187
|
-
).toBeTruthy();
|
|
188
|
-
expect(
|
|
189
|
-
isTrue(
|
|
190
|
-
testSchemaEquality(
|
|
191
|
-
zodUpdateCheckoutSessionSchema,
|
|
192
|
-
typeboxUpdateCheckoutSessionSchema,
|
|
193
|
-
{
|
|
96
|
+
}))).toBeTruthy();
|
|
97
|
+
expect(isTrue(testSchemaEquality(zodUpdateCheckoutSessionSchema, typeboxUpdateCheckoutSessionSchema, {
|
|
194
98
|
id: 'test',
|
|
195
99
|
customerId: 'test',
|
|
196
100
|
paymentMethods: [DummyEnum.A, DummyEnum.B],
|
|
197
101
|
successRedirectUri: 'https://example.com',
|
|
198
102
|
cancelRedirectUri: 'https://example.com',
|
|
199
103
|
extraFields: {
|
|
200
|
-
|
|
104
|
+
test: 'test'
|
|
201
105
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
)
|
|
205
|
-
).toBeTruthy();
|
|
206
|
-
expect(
|
|
207
|
-
isTrue(
|
|
208
|
-
testSchemaEquality(
|
|
209
|
-
zodCheckoutSessionSchema,
|
|
210
|
-
typeboxCheckoutSessionSchema,
|
|
211
|
-
{
|
|
106
|
+
}))).toBeTruthy();
|
|
107
|
+
expect(isTrue(testSchemaEquality(zodCheckoutSessionSchema, typeboxCheckoutSessionSchema, {
|
|
212
108
|
id: 'test',
|
|
213
109
|
customerId: 'test',
|
|
214
110
|
paymentMethods: [DummyEnum.A, DummyEnum.B],
|
|
215
111
|
successRedirectUri: 'https://example.com',
|
|
216
112
|
cancelRedirectUri: 'https://example.com',
|
|
217
113
|
extraFields: {
|
|
218
|
-
|
|
114
|
+
test: 'test'
|
|
219
115
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
});
|
|
225
|
-
it('should be equal for payment link', () => {
|
|
226
|
-
expect(
|
|
227
|
-
isTrue(
|
|
228
|
-
testSchemaEquality(
|
|
229
|
-
zodCreatePaymentLinkSchema,
|
|
230
|
-
typeboxCreatePaymentLinkSchema,
|
|
231
|
-
{
|
|
116
|
+
}))).toBeTruthy();
|
|
117
|
+
});
|
|
118
|
+
it('should be equal for payment link', () => {
|
|
119
|
+
expect(isTrue(testSchemaEquality(zodCreatePaymentLinkSchema, typeboxCreatePaymentLinkSchema, {
|
|
232
120
|
amount: 100,
|
|
233
121
|
currency: DummyEnum.A,
|
|
234
122
|
successRedirectUri: 'https://example.com',
|
|
235
123
|
cancelRedirectUri: 'https://example.com',
|
|
236
124
|
description: 'test',
|
|
237
125
|
metadata: {
|
|
238
|
-
|
|
126
|
+
test: 'test'
|
|
239
127
|
},
|
|
240
128
|
extraFields: {
|
|
241
|
-
|
|
129
|
+
test: 'test'
|
|
242
130
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
)
|
|
246
|
-
).toBeTruthy();
|
|
247
|
-
expect(
|
|
248
|
-
isTrue(
|
|
249
|
-
testSchemaEquality(
|
|
250
|
-
zodUpdatePaymentLinkSchema,
|
|
251
|
-
typeboxUpdatePaymentLinkSchema,
|
|
252
|
-
{
|
|
131
|
+
}))).toBeTruthy();
|
|
132
|
+
expect(isTrue(testSchemaEquality(zodUpdatePaymentLinkSchema, typeboxUpdatePaymentLinkSchema, {
|
|
253
133
|
id: 'test',
|
|
254
134
|
amount: 100,
|
|
255
135
|
currency: DummyEnum.A,
|
|
@@ -257,93 +137,85 @@ describe('schema equality', () => {
|
|
|
257
137
|
cancelRedirectUri: 'https://example.com',
|
|
258
138
|
description: 'test',
|
|
259
139
|
metadata: {
|
|
260
|
-
|
|
140
|
+
test: 'test'
|
|
261
141
|
},
|
|
262
142
|
extraFields: {
|
|
263
|
-
|
|
143
|
+
test: 'test'
|
|
264
144
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
testSchemaEquality(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
});
|
|
340
|
-
it('should be equal for subscription', () => {
|
|
341
|
-
expect(
|
|
342
|
-
isTrue(
|
|
343
|
-
testSchemaEquality(
|
|
344
|
-
zodCreateSubscriptionSchema,
|
|
345
|
-
typeboxCreateSubscriptionSchema,
|
|
346
|
-
{
|
|
145
|
+
})));
|
|
146
|
+
expect(isTrue(testSchemaEquality(zodPaymentLinkSchema, typeboxPaymentLinkSchema, {
|
|
147
|
+
id: 'test',
|
|
148
|
+
amount: 100,
|
|
149
|
+
currency: DummyEnum.A,
|
|
150
|
+
successRedirectUri: 'https://example.com',
|
|
151
|
+
cancelRedirectUri: 'https://example.com',
|
|
152
|
+
description: 'test',
|
|
153
|
+
metadata: {
|
|
154
|
+
test: 'test'
|
|
155
|
+
},
|
|
156
|
+
extraFields: {
|
|
157
|
+
test: 'test'
|
|
158
|
+
}
|
|
159
|
+
}))).toBeTruthy();
|
|
160
|
+
});
|
|
161
|
+
it('should be equal for plan', () => {
|
|
162
|
+
expect(isTrue(testSchemaEquality(zodCreatePlanSchema, typeboxCreatePlanSchema, {
|
|
163
|
+
name: 'test',
|
|
164
|
+
price: 100,
|
|
165
|
+
cadence: DummyEnum.A,
|
|
166
|
+
features: [DummyEnum.A, DummyEnum.B],
|
|
167
|
+
externalId: 'test',
|
|
168
|
+
active: true,
|
|
169
|
+
description: 'test',
|
|
170
|
+
extraFields: {
|
|
171
|
+
test: 'test'
|
|
172
|
+
}
|
|
173
|
+
}))).toBeTruthy();
|
|
174
|
+
expect(isTrue(testSchemaEquality(zodUpdatePlanSchema, typeboxUpdatePlanSchema, {
|
|
175
|
+
id: 'test',
|
|
176
|
+
name: 'test',
|
|
177
|
+
price: 100,
|
|
178
|
+
cadence: DummyEnum.A,
|
|
179
|
+
features: [DummyEnum.A, DummyEnum.B],
|
|
180
|
+
externalId: 'test',
|
|
181
|
+
active: true,
|
|
182
|
+
description: 'test',
|
|
183
|
+
extraFields: {
|
|
184
|
+
test: 'test'
|
|
185
|
+
}
|
|
186
|
+
}))).toBeTruthy();
|
|
187
|
+
expect(isTrue(testSchemaEquality(zodPlanSchema, typeboxPlanSchema, {
|
|
188
|
+
id: 'test',
|
|
189
|
+
name: 'test',
|
|
190
|
+
price: 100,
|
|
191
|
+
cadence: DummyEnum.A,
|
|
192
|
+
features: [DummyEnum.A, DummyEnum.B],
|
|
193
|
+
externalId: 'test',
|
|
194
|
+
active: true,
|
|
195
|
+
description: 'test',
|
|
196
|
+
extraFields: {
|
|
197
|
+
test: 'test'
|
|
198
|
+
}
|
|
199
|
+
}))).toBeTruthy();
|
|
200
|
+
});
|
|
201
|
+
it('should be equal for subscription', () => {
|
|
202
|
+
expect(isTrue(testSchemaEquality(zodCreateSubscriptionSchema, typeboxCreateSubscriptionSchema, {
|
|
203
|
+
partyId: 'test',
|
|
204
|
+
partyType: DummyEnum.A,
|
|
205
|
+
productId: 'test',
|
|
206
|
+
status: DummyEnum.A,
|
|
207
|
+
active: true,
|
|
208
|
+
externalId: 'test',
|
|
209
|
+
startDate: new Date(),
|
|
210
|
+
endDate: new Date(),
|
|
211
|
+
description: 'test',
|
|
212
|
+
extraFields: {
|
|
213
|
+
test: 'test'
|
|
214
|
+
},
|
|
215
|
+
billingProvider: DummyEnum.A
|
|
216
|
+
}))).toBeTruthy();
|
|
217
|
+
expect(isTrue(testSchemaEquality(zodUpdateSubscriptionSchema, typeboxUpdateSubscriptionSchema, {
|
|
218
|
+
id: 'test',
|
|
347
219
|
partyId: 'test',
|
|
348
220
|
partyType: DummyEnum.A,
|
|
349
221
|
productId: 'test',
|
|
@@ -354,19 +226,11 @@ describe('schema equality', () => {
|
|
|
354
226
|
endDate: new Date(),
|
|
355
227
|
description: 'test',
|
|
356
228
|
extraFields: {
|
|
357
|
-
|
|
229
|
+
test: 'test'
|
|
358
230
|
},
|
|
359
231
|
billingProvider: DummyEnum.A
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
)
|
|
363
|
-
).toBeTruthy();
|
|
364
|
-
expect(
|
|
365
|
-
isTrue(
|
|
366
|
-
testSchemaEquality(
|
|
367
|
-
zodUpdateSubscriptionSchema,
|
|
368
|
-
typeboxUpdateSubscriptionSchema,
|
|
369
|
-
{
|
|
232
|
+
}))).toBeTruthy();
|
|
233
|
+
expect(isTrue(testSchemaEquality(zodSubscriptionSchema, typeboxSubscriptionSchema, {
|
|
370
234
|
id: 'test',
|
|
371
235
|
partyId: 'test',
|
|
372
236
|
partyType: DummyEnum.A,
|
|
@@ -378,32 +242,9 @@ describe('schema equality', () => {
|
|
|
378
242
|
endDate: new Date(),
|
|
379
243
|
description: 'test',
|
|
380
244
|
extraFields: {
|
|
381
|
-
|
|
245
|
+
test: 'test'
|
|
382
246
|
},
|
|
383
247
|
billingProvider: DummyEnum.A
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
)
|
|
387
|
-
).toBeTruthy();
|
|
388
|
-
expect(
|
|
389
|
-
isTrue(
|
|
390
|
-
testSchemaEquality(zodSubscriptionSchema, typeboxSubscriptionSchema, {
|
|
391
|
-
id: 'test',
|
|
392
|
-
partyId: 'test',
|
|
393
|
-
partyType: DummyEnum.A,
|
|
394
|
-
productId: 'test',
|
|
395
|
-
status: DummyEnum.A,
|
|
396
|
-
active: true,
|
|
397
|
-
externalId: 'test',
|
|
398
|
-
startDate: new Date(),
|
|
399
|
-
endDate: new Date(),
|
|
400
|
-
description: 'test',
|
|
401
|
-
extraFields: {
|
|
402
|
-
test: 'test'
|
|
403
|
-
},
|
|
404
|
-
billingProvider: DummyEnum.A
|
|
405
|
-
})
|
|
406
|
-
)
|
|
407
|
-
).toBeTruthy();
|
|
408
|
-
});
|
|
248
|
+
}))).toBeTruthy();
|
|
249
|
+
});
|
|
409
250
|
});
|
package/lib/jest.config.d.ts
CHANGED
package/lib/jest.config.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
const jestConfig = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
preset: 'ts-jest/presets/default-esm', // or other ESM presets
|
|
3
|
+
moduleNameMapper: {
|
|
4
|
+
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
5
|
+
},
|
|
6
|
+
transform: {
|
|
7
|
+
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
|
|
8
|
+
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
|
|
9
|
+
'^.+\\.[tj]sx?$': [
|
|
10
|
+
'ts-jest',
|
|
11
|
+
{
|
|
12
|
+
useESM: true
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
'^.+\\.js$': 'babel-jest'
|
|
16
|
+
},
|
|
17
|
+
testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
|
|
18
18
|
};
|
|
19
19
|
export default jestConfig;
|