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