@faire-auth/stripe 1.0.0

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.
@@ -0,0 +1,1578 @@
1
+
2
+ > @faire-auth/stripe@1.4.0-beta.11 test /home/igoforth/.local/src/faire-auth/packages/stripe
3
+ > vitest --run
4
+
5
+
6
+ RUN v3.2.4 /home/igoforth/.local/src/faire-auth/packages/stripe
7
+
8
+ stdout | src/stripe.test.ts > stripe > should create a customer on sign up
9
+ 116.40ms fetch('http://localhost:3000/api/auth/sign-up/email', {
10
+ customFetchImpl: [AsyncFunction: customFetchImpl],
11
+ body: '{"email":"test@email.com","password":"password","name":"Test User"}',
12
+ method: 'POST',
13
+ headers: Headers { 'Content-Type': 'application/json' },
14
+ onSuccess: [AsyncFunction: onSuccess]
15
+ }): {
16
+ data: {
17
+ success: true,
18
+ data: {
19
+ success: true,
20
+ token: '05TYHlkArF0tHUHPpClrMgtCt4BPZO95',
21
+ user: [Object],
22
+ redirect: false,
23
+ url: null
24
+ }
25
+ },
26
+ error: null
27
+ }
28
+
29
+ stdout | src/stripe.test.ts > stripe > should create a subscription
30
+ 110.85ms fetch('http://localhost:3000/api/auth/sign-up/email', {
31
+ customFetchImpl: [AsyncFunction: customFetchImpl],
32
+ body: '{"email":"test@email.com","password":"password","name":"Test User"}',
33
+ method: 'POST',
34
+ headers: Headers { 'Content-Type': 'application/json' },
35
+ onSuccess: [AsyncFunction: onSuccess]
36
+ }): {
37
+ data: {
38
+ success: true,
39
+ data: {
40
+ success: true,
41
+ token: 'T3SoL0HCOFRp4IugIADRZiTvk2m6uIE1',
42
+ user: [Object],
43
+ redirect: false,
44
+ url: null
45
+ }
46
+ },
47
+ error: null
48
+ }
49
+
50
+ stdout | src/stripe.test.ts > stripe > should create a subscription
51
+ 91.96ms fetch('http://localhost:3000/api/auth/sign-in/email', {
52
+ customFetchImpl: [AsyncFunction: customFetchImpl],
53
+ onSuccess: [AsyncFunction: onSuccess],
54
+ body: '{"email":"test@email.com","password":"password","name":"Test User"}',
55
+ method: 'POST',
56
+ headers: Headers { 'Content-Type': 'application/json' }
57
+ }): {
58
+ data: {
59
+ success: true,
60
+ data: {
61
+ success: true,
62
+ token: 'WVeVHUCraHnyviXI6j7UHhb2AKyh2s7H',
63
+ user: [Object],
64
+ redirect: false,
65
+ url: null
66
+ }
67
+ },
68
+ error: null
69
+ }
70
+
71
+ stdout | src/stripe.test.ts > stripe > should create a subscription
72
+ 1.72ms getSession({ query: {} }, Context {
73
+ env: {
74
+ FAIRE_AUTH_SECRET: [Getter],
75
+ AUTH_SECRET: [Getter],
76
+ FAIRE_AUTH_TELEMETRY: [Getter],
77
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
78
+ NODE_ENV: [Getter],
79
+ PACKAGE_VERSION: [Getter],
80
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
81
+ },
82
+ finalized: false,
83
+ error: undefined,
84
+ render: [Function: render],
85
+ setLayout: [Function: setLayout],
86
+ getLayout: [Function: getLayout],
87
+ setRenderer: [Function: setRenderer],
88
+ header: [Function: header],
89
+ status: [Function: status],
90
+ set: [Function: set],
91
+ get: [Function: get],
92
+ newResponse: [Function: newResponse],
93
+ body: [Function: body],
94
+ text: [Function: text],
95
+ json: [Function: json],
96
+ html: [Function: html],
97
+ redirect: [Function: redirect],
98
+ notFound: [Function: notFound],
99
+ executionCtx: [Getter]
100
+ }): {
101
+ success: true,
102
+ data: {
103
+ session: {
104
+ id: 'ZqQDDKGgg2fotWfgQiW3Sf9TbIk2aanX',
105
+ createdAt: '2026-03-26T14:56:06.789Z',
106
+ updatedAt: '2026-03-26T14:56:06.789Z',
107
+ userId: 'tGmrQi58hv4PQcnAuqwxsdJi8Q6yTiuU',
108
+ expiresAt: '2026-04-02T14:56:06.788Z',
109
+ token: 'WVeVHUCraHnyviXI6j7UHhb2AKyh2s7H',
110
+ ipAddress: '127.0.0.1'
111
+ },
112
+ user: {
113
+ id: 'tGmrQi58hv4PQcnAuqwxsdJi8Q6yTiuU',
114
+ createdAt: '2026-03-26T14:56:06.695Z',
115
+ updatedAt: '2026-03-26T14:56:06.696Z',
116
+ email: 'test@email.com',
117
+ emailVerified: false,
118
+ name: 'Test User',
119
+ stripeCustomerId: 'cus_mock123'
120
+ }
121
+ }
122
+ }
123
+
124
+ stdout | src/stripe.test.ts > stripe > should create a subscription
125
+ 5.46ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
126
+ customFetchImpl: [AsyncFunction: customFetchImpl],
127
+ body: '{"plan":"starter"}',
128
+ method: 'POST',
129
+ headers: Headers {
130
+ cookie: 'faire-auth.session_token=WVeVHUCraHnyviXI6j7UHhb2AKyh2s7H.SUkG6nIrslHPEnIjqysVTSr2rWBjuiwlBZy2tsvEDQ8%3D',
131
+ 'Content-Type': 'application/json'
132
+ },
133
+ onSuccess: [AsyncFunction: onSuccess]
134
+ }): {
135
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
136
+ error: null
137
+ }
138
+
139
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
140
+ 96.37ms fetch('http://localhost:3000/api/auth/sign-up/email', {
141
+ customFetchImpl: [AsyncFunction: customFetchImpl],
142
+ body: '{"email":"list-test@email.com","password":"password","name":"Test User"}',
143
+ method: 'POST',
144
+ headers: Headers { 'Content-Type': 'application/json' },
145
+ onSuccess: [AsyncFunction: onSuccess]
146
+ }): {
147
+ data: {
148
+ success: true,
149
+ data: {
150
+ success: true,
151
+ token: 'n6qnMpYEpqMVqEfnatYOGOaz1VYCB1QW',
152
+ user: [Object],
153
+ redirect: false,
154
+ url: null
155
+ }
156
+ },
157
+ error: null
158
+ }
159
+
160
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
161
+ 87.98ms fetch('http://localhost:3000/api/auth/sign-in/email', {
162
+ customFetchImpl: [AsyncFunction: customFetchImpl],
163
+ onSuccess: [AsyncFunction: onSuccess],
164
+ body: '{"email":"list-test@email.com","password":"password","name":"Test User"}',
165
+ method: 'POST',
166
+ headers: Headers { 'Content-Type': 'application/json' }
167
+ }): {
168
+ data: {
169
+ success: true,
170
+ data: {
171
+ success: true,
172
+ token: 'icvLrr7y5JgxonmWXJDNvpFwabmZATI9',
173
+ user: [Object],
174
+ redirect: false,
175
+ url: null
176
+ }
177
+ },
178
+ error: null
179
+ }
180
+
181
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
182
+ 1.13ms getSession({ query: {} }, Context {
183
+ env: {
184
+ FAIRE_AUTH_SECRET: [Getter],
185
+ AUTH_SECRET: [Getter],
186
+ FAIRE_AUTH_TELEMETRY: [Getter],
187
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
188
+ NODE_ENV: [Getter],
189
+ PACKAGE_VERSION: [Getter],
190
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
191
+ },
192
+ finalized: false,
193
+ error: undefined,
194
+ render: [Function: render],
195
+ setLayout: [Function: setLayout],
196
+ getLayout: [Function: getLayout],
197
+ setRenderer: [Function: setRenderer],
198
+ header: [Function: header],
199
+ status: [Function: status],
200
+ set: [Function: set],
201
+ get: [Function: get],
202
+ newResponse: [Function: newResponse],
203
+ body: [Function: body],
204
+ text: [Function: text],
205
+ json: [Function: json],
206
+ html: [Function: html],
207
+ redirect: [Function: redirect],
208
+ notFound: [Function: notFound],
209
+ executionCtx: [Getter]
210
+ }): {
211
+ success: true,
212
+ data: {
213
+ session: {
214
+ id: 'v8sw8iFCw4hf6zQUJXkFB87CtxsK7adk',
215
+ createdAt: '2026-03-26T14:56:06.981Z',
216
+ updatedAt: '2026-03-26T14:56:06.981Z',
217
+ userId: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
218
+ expiresAt: '2026-04-02T14:56:06.981Z',
219
+ token: 'icvLrr7y5JgxonmWXJDNvpFwabmZATI9',
220
+ ipAddress: '127.0.0.1'
221
+ },
222
+ user: {
223
+ id: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
224
+ createdAt: '2026-03-26T14:56:06.893Z',
225
+ updatedAt: '2026-03-26T14:56:06.893Z',
226
+ email: 'list-test@email.com',
227
+ emailVerified: false,
228
+ name: 'Test User',
229
+ stripeCustomerId: 'cus_mock123'
230
+ }
231
+ }
232
+ }
233
+
234
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
235
+ 3.84ms fetch('http://localhost:3000/api/auth/subscription/list', {
236
+ customFetchImpl: [AsyncFunction: customFetchImpl],
237
+ method: 'GET',
238
+ headers: Headers {
239
+ cookie: 'faire-auth.session_token=icvLrr7y5JgxonmWXJDNvpFwabmZATI9.njiIVy2EUhhqMkd1HbD%2BwwIj3Y7sF19JQdns8Qm31T8%3D'
240
+ },
241
+ onSuccess: [AsyncFunction: onSuccess]
242
+ }): { data: [], error: null }
243
+
244
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
245
+ 0.59ms getSession({ query: {} }, Context {
246
+ env: {
247
+ FAIRE_AUTH_SECRET: [Getter],
248
+ AUTH_SECRET: [Getter],
249
+ FAIRE_AUTH_TELEMETRY: [Getter],
250
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
251
+ NODE_ENV: [Getter],
252
+ PACKAGE_VERSION: [Getter],
253
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
254
+ },
255
+ finalized: false,
256
+ error: undefined,
257
+ render: [Function: render],
258
+ setLayout: [Function: setLayout],
259
+ getLayout: [Function: getLayout],
260
+ setRenderer: [Function: setRenderer],
261
+ header: [Function: header],
262
+ status: [Function: status],
263
+ set: [Function: set],
264
+ get: [Function: get],
265
+ newResponse: [Function: newResponse],
266
+ body: [Function: body],
267
+ text: [Function: text],
268
+ json: [Function: json],
269
+ html: [Function: html],
270
+ redirect: [Function: redirect],
271
+ notFound: [Function: notFound],
272
+ executionCtx: [Getter]
273
+ }): {
274
+ success: true,
275
+ data: {
276
+ session: {
277
+ id: 'v8sw8iFCw4hf6zQUJXkFB87CtxsK7adk',
278
+ createdAt: '2026-03-26T14:56:06.981Z',
279
+ updatedAt: '2026-03-26T14:56:06.981Z',
280
+ userId: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
281
+ expiresAt: '2026-04-02T14:56:06.981Z',
282
+ token: 'icvLrr7y5JgxonmWXJDNvpFwabmZATI9',
283
+ ipAddress: '127.0.0.1'
284
+ },
285
+ user: {
286
+ id: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
287
+ createdAt: '2026-03-26T14:56:06.893Z',
288
+ updatedAt: '2026-03-26T14:56:06.893Z',
289
+ email: 'list-test@email.com',
290
+ emailVerified: false,
291
+ name: 'Test User',
292
+ stripeCustomerId: 'cus_mock123'
293
+ }
294
+ }
295
+ }
296
+
297
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
298
+ 2.02ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
299
+ customFetchImpl: [AsyncFunction: customFetchImpl],
300
+ body: '{"plan":"starter"}',
301
+ method: 'POST',
302
+ headers: Headers {
303
+ cookie: 'faire-auth.session_token=icvLrr7y5JgxonmWXJDNvpFwabmZATI9.njiIVy2EUhhqMkd1HbD%2BwwIj3Y7sF19JQdns8Qm31T8%3D',
304
+ 'Content-Type': 'application/json'
305
+ },
306
+ onSuccess: [AsyncFunction: onSuccess]
307
+ }): {
308
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
309
+ error: null
310
+ }
311
+
312
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
313
+ 0.47ms getSession({ query: {} }, Context {
314
+ env: {
315
+ FAIRE_AUTH_SECRET: [Getter],
316
+ AUTH_SECRET: [Getter],
317
+ FAIRE_AUTH_TELEMETRY: [Getter],
318
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
319
+ NODE_ENV: [Getter],
320
+ PACKAGE_VERSION: [Getter],
321
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
322
+ },
323
+ finalized: false,
324
+ error: undefined,
325
+ render: [Function: render],
326
+ setLayout: [Function: setLayout],
327
+ getLayout: [Function: getLayout],
328
+ setRenderer: [Function: setRenderer],
329
+ header: [Function: header],
330
+ status: [Function: status],
331
+ set: [Function: set],
332
+ get: [Function: get],
333
+ newResponse: [Function: newResponse],
334
+ body: [Function: body],
335
+ text: [Function: text],
336
+ json: [Function: json],
337
+ html: [Function: html],
338
+ redirect: [Function: redirect],
339
+ notFound: [Function: notFound],
340
+ executionCtx: [Getter]
341
+ }): {
342
+ success: true,
343
+ data: {
344
+ session: {
345
+ id: 'v8sw8iFCw4hf6zQUJXkFB87CtxsK7adk',
346
+ createdAt: '2026-03-26T14:56:06.981Z',
347
+ updatedAt: '2026-03-26T14:56:06.981Z',
348
+ userId: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
349
+ expiresAt: '2026-04-02T14:56:06.981Z',
350
+ token: 'icvLrr7y5JgxonmWXJDNvpFwabmZATI9',
351
+ ipAddress: '127.0.0.1'
352
+ },
353
+ user: {
354
+ id: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
355
+ createdAt: '2026-03-26T14:56:06.893Z',
356
+ updatedAt: '2026-03-26T14:56:06.893Z',
357
+ email: 'list-test@email.com',
358
+ emailVerified: false,
359
+ name: 'Test User',
360
+ stripeCustomerId: 'cus_mock123'
361
+ }
362
+ }
363
+ }
364
+
365
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
366
+ 1.43ms fetch('http://localhost:3000/api/auth/subscription/list', {
367
+ customFetchImpl: [AsyncFunction: customFetchImpl],
368
+ method: 'GET',
369
+ headers: Headers {
370
+ cookie: 'faire-auth.session_token=icvLrr7y5JgxonmWXJDNvpFwabmZATI9.njiIVy2EUhhqMkd1HbD%2BwwIj3Y7sF19JQdns8Qm31T8%3D'
371
+ },
372
+ onSuccess: [AsyncFunction: onSuccess]
373
+ }): { data: [], error: null }
374
+
375
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
376
+ 0.41ms getSession({ query: {} }, Context {
377
+ env: {
378
+ FAIRE_AUTH_SECRET: [Getter],
379
+ AUTH_SECRET: [Getter],
380
+ FAIRE_AUTH_TELEMETRY: [Getter],
381
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
382
+ NODE_ENV: [Getter],
383
+ PACKAGE_VERSION: [Getter],
384
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
385
+ },
386
+ finalized: false,
387
+ error: undefined,
388
+ render: [Function: render],
389
+ setLayout: [Function: setLayout],
390
+ getLayout: [Function: getLayout],
391
+ setRenderer: [Function: setRenderer],
392
+ header: [Function: header],
393
+ status: [Function: status],
394
+ set: [Function: set],
395
+ get: [Function: get],
396
+ newResponse: [Function: newResponse],
397
+ body: [Function: body],
398
+ text: [Function: text],
399
+ json: [Function: json],
400
+ html: [Function: html],
401
+ redirect: [Function: redirect],
402
+ notFound: [Function: notFound],
403
+ executionCtx: [Getter]
404
+ }): {
405
+ success: true,
406
+ data: {
407
+ session: {
408
+ id: 'v8sw8iFCw4hf6zQUJXkFB87CtxsK7adk',
409
+ createdAt: '2026-03-26T14:56:06.981Z',
410
+ updatedAt: '2026-03-26T14:56:06.981Z',
411
+ userId: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
412
+ expiresAt: '2026-04-02T14:56:06.981Z',
413
+ token: 'icvLrr7y5JgxonmWXJDNvpFwabmZATI9',
414
+ ipAddress: '127.0.0.1'
415
+ },
416
+ user: {
417
+ id: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
418
+ createdAt: '2026-03-26T14:56:06.893Z',
419
+ updatedAt: '2026-03-26T14:56:06.893Z',
420
+ email: 'list-test@email.com',
421
+ emailVerified: false,
422
+ name: 'Test User',
423
+ stripeCustomerId: 'cus_mock123'
424
+ }
425
+ }
426
+ }
427
+
428
+ stdout | src/stripe.test.ts > stripe > should list active subscriptions
429
+ 1.08ms fetch('http://localhost:3000/api/auth/subscription/list', {
430
+ customFetchImpl: [AsyncFunction: customFetchImpl],
431
+ method: 'GET',
432
+ headers: Headers {
433
+ cookie: 'faire-auth.session_token=icvLrr7y5JgxonmWXJDNvpFwabmZATI9.njiIVy2EUhhqMkd1HbD%2BwwIj3Y7sF19JQdns8Qm31T8%3D'
434
+ },
435
+ onSuccess: [AsyncFunction: onSuccess]
436
+ }): {
437
+ data: [
438
+ {
439
+ plan: 'starter',
440
+ referenceId: 'leL8l6sSXe8mxx0NfGlTcAfMrQmq7dKq',
441
+ stripeCustomerId: 'cus_mock123',
442
+ status: 'active',
443
+ cancelAtPeriodEnd: false,
444
+ seats: 1,
445
+ id: 'TQbiEjS11SJ4hUSXfFcVaaCQfXJ9GeXS'
446
+ }
447
+ ],
448
+ error: null
449
+ }
450
+
451
+ stdout | src/stripe.test.ts > stripe > should allow seat upgrades for the same plan
452
+ 92.78ms fetch('http://localhost:3000/api/auth/sign-up/email', {
453
+ customFetchImpl: [AsyncFunction: customFetchImpl],
454
+ body: '{"email":"seat-upgrade@email.com","password":"password","name":"Test User"}',
455
+ method: 'POST',
456
+ headers: Headers { 'Content-Type': 'application/json' },
457
+ onSuccess: [AsyncFunction: onSuccess]
458
+ }): {
459
+ data: {
460
+ success: true,
461
+ data: {
462
+ success: true,
463
+ token: 'ns9PeuOZN35iNUd5nv1c9VvBWi0M1O72',
464
+ user: [Object],
465
+ redirect: false,
466
+ url: null
467
+ }
468
+ },
469
+ error: null
470
+ }
471
+
472
+ stdout | src/stripe.test.ts > stripe > should allow seat upgrades for the same plan
473
+ 84.22ms fetch('http://localhost:3000/api/auth/sign-in/email', {
474
+ customFetchImpl: [AsyncFunction: customFetchImpl],
475
+ onSuccess: [AsyncFunction: onSuccess],
476
+ body: '{"email":"seat-upgrade@email.com","password":"password","name":"Test User"}',
477
+ method: 'POST',
478
+ headers: Headers { 'Content-Type': 'application/json' }
479
+ }): {
480
+ data: {
481
+ success: true,
482
+ data: {
483
+ success: true,
484
+ token: 'bhLFOB9rJuc41KMMk6r7XWvDFI3dGxmr',
485
+ user: [Object],
486
+ redirect: false,
487
+ url: null
488
+ }
489
+ },
490
+ error: null
491
+ }
492
+
493
+ stdout | src/stripe.test.ts > stripe > should allow seat upgrades for the same plan
494
+ 0.48ms getSession({ query: {} }, Context {
495
+ env: {
496
+ FAIRE_AUTH_SECRET: [Getter],
497
+ AUTH_SECRET: [Getter],
498
+ FAIRE_AUTH_TELEMETRY: [Getter],
499
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
500
+ NODE_ENV: [Getter],
501
+ PACKAGE_VERSION: [Getter],
502
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
503
+ },
504
+ finalized: false,
505
+ error: undefined,
506
+ render: [Function: render],
507
+ setLayout: [Function: setLayout],
508
+ getLayout: [Function: getLayout],
509
+ setRenderer: [Function: setRenderer],
510
+ header: [Function: header],
511
+ status: [Function: status],
512
+ set: [Function: set],
513
+ get: [Function: get],
514
+ newResponse: [Function: newResponse],
515
+ body: [Function: body],
516
+ text: [Function: text],
517
+ json: [Function: json],
518
+ html: [Function: html],
519
+ redirect: [Function: redirect],
520
+ notFound: [Function: notFound],
521
+ executionCtx: [Getter]
522
+ }): {
523
+ success: true,
524
+ data: {
525
+ session: {
526
+ id: 'lVWNFKM6CA1YF7Qu8RnrKf8JhIOlB3ve',
527
+ createdAt: '2026-03-26T14:56:07.209Z',
528
+ updatedAt: '2026-03-26T14:56:07.209Z',
529
+ userId: '5tZ9YDrosOgRqwWini8CDnKdvfU3rF7o',
530
+ expiresAt: '2026-04-02T14:56:07.209Z',
531
+ token: 'bhLFOB9rJuc41KMMk6r7XWvDFI3dGxmr',
532
+ ipAddress: '127.0.0.1'
533
+ },
534
+ user: {
535
+ id: '5tZ9YDrosOgRqwWini8CDnKdvfU3rF7o',
536
+ createdAt: '2026-03-26T14:56:07.124Z',
537
+ updatedAt: '2026-03-26T14:56:07.124Z',
538
+ email: 'seat-upgrade@email.com',
539
+ emailVerified: false,
540
+ name: 'Test User',
541
+ stripeCustomerId: 'cus_mock123'
542
+ }
543
+ }
544
+ }
545
+
546
+ stdout | src/stripe.test.ts > stripe > should allow seat upgrades for the same plan
547
+ 1.56ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
548
+ customFetchImpl: [AsyncFunction: customFetchImpl],
549
+ body: '{"plan":"starter","seats":1}',
550
+ method: 'POST',
551
+ headers: Headers {
552
+ cookie: 'faire-auth.session_token=bhLFOB9rJuc41KMMk6r7XWvDFI3dGxmr.z8bNXHGWYaPyRgk9lMG%2F%2BIczQGPhGSlwNKJryWm91hg%3D',
553
+ 'Content-Type': 'application/json'
554
+ },
555
+ onSuccess: [AsyncFunction: onSuccess]
556
+ }): {
557
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
558
+ error: null
559
+ }
560
+
561
+ stdout | src/stripe.test.ts > stripe > should allow seat upgrades for the same plan
562
+ 0.35ms getSession({ query: {} }, Context {
563
+ env: {
564
+ FAIRE_AUTH_SECRET: [Getter],
565
+ AUTH_SECRET: [Getter],
566
+ FAIRE_AUTH_TELEMETRY: [Getter],
567
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
568
+ NODE_ENV: [Getter],
569
+ PACKAGE_VERSION: [Getter],
570
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
571
+ },
572
+ finalized: false,
573
+ error: undefined,
574
+ render: [Function: render],
575
+ setLayout: [Function: setLayout],
576
+ getLayout: [Function: getLayout],
577
+ setRenderer: [Function: setRenderer],
578
+ header: [Function: header],
579
+ status: [Function: status],
580
+ set: [Function: set],
581
+ get: [Function: get],
582
+ newResponse: [Function: newResponse],
583
+ body: [Function: body],
584
+ text: [Function: text],
585
+ json: [Function: json],
586
+ html: [Function: html],
587
+ redirect: [Function: redirect],
588
+ notFound: [Function: notFound],
589
+ executionCtx: [Getter]
590
+ }): {
591
+ success: true,
592
+ data: {
593
+ session: {
594
+ id: 'lVWNFKM6CA1YF7Qu8RnrKf8JhIOlB3ve',
595
+ createdAt: '2026-03-26T14:56:07.209Z',
596
+ updatedAt: '2026-03-26T14:56:07.209Z',
597
+ userId: '5tZ9YDrosOgRqwWini8CDnKdvfU3rF7o',
598
+ expiresAt: '2026-04-02T14:56:07.209Z',
599
+ token: 'bhLFOB9rJuc41KMMk6r7XWvDFI3dGxmr',
600
+ ipAddress: '127.0.0.1'
601
+ },
602
+ user: {
603
+ id: '5tZ9YDrosOgRqwWini8CDnKdvfU3rF7o',
604
+ createdAt: '2026-03-26T14:56:07.124Z',
605
+ updatedAt: '2026-03-26T14:56:07.124Z',
606
+ email: 'seat-upgrade@email.com',
607
+ emailVerified: false,
608
+ name: 'Test User',
609
+ stripeCustomerId: 'cus_mock123'
610
+ }
611
+ }
612
+ }
613
+
614
+ stdout | src/stripe.test.ts > stripe > should allow seat upgrades for the same plan
615
+ 1.12ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
616
+ customFetchImpl: [AsyncFunction: customFetchImpl],
617
+ body: '{"plan":"starter","seats":5}',
618
+ method: 'POST',
619
+ headers: Headers {
620
+ cookie: 'faire-auth.session_token=bhLFOB9rJuc41KMMk6r7XWvDFI3dGxmr.z8bNXHGWYaPyRgk9lMG%2F%2BIczQGPhGSlwNKJryWm91hg%3D',
621
+ 'Content-Type': 'application/json'
622
+ },
623
+ onSuccess: [AsyncFunction: onSuccess]
624
+ }): {
625
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
626
+ error: null
627
+ }
628
+
629
+ stdout | src/stripe.test.ts > stripe > should prevent duplicate subscriptions with same plan and same seats
630
+ 93.48ms fetch('http://localhost:3000/api/auth/sign-up/email', {
631
+ customFetchImpl: [AsyncFunction: customFetchImpl],
632
+ body: '{"email":"duplicate-prevention@email.com","password":"password","name":"Test User"}',
633
+ method: 'POST',
634
+ headers: Headers { 'Content-Type': 'application/json' },
635
+ onSuccess: [AsyncFunction: onSuccess]
636
+ }): {
637
+ data: {
638
+ success: true,
639
+ data: {
640
+ success: true,
641
+ token: 'xyK0m0OwmzezLRE8aQ0vhL2cJBNK0iGl',
642
+ user: [Object],
643
+ redirect: false,
644
+ url: null
645
+ }
646
+ },
647
+ error: null
648
+ }
649
+
650
+ stdout | src/stripe.test.ts > stripe > should prevent duplicate subscriptions with same plan and same seats
651
+ 103.02ms fetch('http://localhost:3000/api/auth/sign-in/email', {
652
+ customFetchImpl: [AsyncFunction: customFetchImpl],
653
+ onSuccess: [AsyncFunction: onSuccess],
654
+ body: '{"email":"duplicate-prevention@email.com","password":"password","name":"Test User"}',
655
+ method: 'POST',
656
+ headers: Headers { 'Content-Type': 'application/json' }
657
+ }): {
658
+ data: {
659
+ success: true,
660
+ data: {
661
+ success: true,
662
+ token: 'xi9vv1y6t2PrBhBMHTO5OsRNcdKsvClC',
663
+ user: [Object],
664
+ redirect: false,
665
+ url: null
666
+ }
667
+ },
668
+ error: null
669
+ }
670
+
671
+ stdout | src/stripe.test.ts > stripe > should prevent duplicate subscriptions with same plan and same seats
672
+ 0.68ms getSession({ query: {} }, Context {
673
+ env: {
674
+ FAIRE_AUTH_SECRET: [Getter],
675
+ AUTH_SECRET: [Getter],
676
+ FAIRE_AUTH_TELEMETRY: [Getter],
677
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
678
+ NODE_ENV: [Getter],
679
+ PACKAGE_VERSION: [Getter],
680
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
681
+ },
682
+ finalized: false,
683
+ error: undefined,
684
+ render: [Function: render],
685
+ setLayout: [Function: setLayout],
686
+ getLayout: [Function: getLayout],
687
+ setRenderer: [Function: setRenderer],
688
+ header: [Function: header],
689
+ status: [Function: status],
690
+ set: [Function: set],
691
+ get: [Function: get],
692
+ newResponse: [Function: newResponse],
693
+ body: [Function: body],
694
+ text: [Function: text],
695
+ json: [Function: json],
696
+ html: [Function: html],
697
+ redirect: [Function: redirect],
698
+ notFound: [Function: notFound],
699
+ executionCtx: [Getter]
700
+ }): {
701
+ success: true,
702
+ data: {
703
+ session: {
704
+ id: 'rC1URIvi1B4GOxdWcwGGVqJ9OJeLdbKR',
705
+ createdAt: '2026-03-26T14:56:07.409Z',
706
+ updatedAt: '2026-03-26T14:56:07.409Z',
707
+ userId: 'rke3xED2HXvZZXixzDxC94OraRtrGC1A',
708
+ expiresAt: '2026-04-02T14:56:07.409Z',
709
+ token: 'xi9vv1y6t2PrBhBMHTO5OsRNcdKsvClC',
710
+ ipAddress: '127.0.0.1'
711
+ },
712
+ user: {
713
+ id: 'rke3xED2HXvZZXixzDxC94OraRtrGC1A',
714
+ createdAt: '2026-03-26T14:56:07.306Z',
715
+ updatedAt: '2026-03-26T14:56:07.306Z',
716
+ email: 'duplicate-prevention@email.com',
717
+ emailVerified: false,
718
+ name: 'Test User',
719
+ stripeCustomerId: 'cus_mock123'
720
+ }
721
+ }
722
+ }
723
+
724
+ stdout | src/stripe.test.ts > stripe > should prevent duplicate subscriptions with same plan and same seats
725
+ 2.20ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
726
+ customFetchImpl: [AsyncFunction: customFetchImpl],
727
+ body: '{"plan":"starter","seats":3}',
728
+ method: 'POST',
729
+ headers: Headers {
730
+ cookie: 'faire-auth.session_token=xi9vv1y6t2PrBhBMHTO5OsRNcdKsvClC.HvfzY2Coz768SxKlbwdyec9y5mdgbIBuJ7Oy1khkIKc%3D',
731
+ 'Content-Type': 'application/json'
732
+ },
733
+ onSuccess: [AsyncFunction: onSuccess]
734
+ }): {
735
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
736
+ error: null
737
+ }
738
+
739
+ stdout | src/stripe.test.ts > stripe > should prevent duplicate subscriptions with same plan and same seats
740
+ 0.64ms getSession({ query: {} }, Context {
741
+ env: {
742
+ FAIRE_AUTH_SECRET: [Getter],
743
+ AUTH_SECRET: [Getter],
744
+ FAIRE_AUTH_TELEMETRY: [Getter],
745
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
746
+ NODE_ENV: [Getter],
747
+ PACKAGE_VERSION: [Getter],
748
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
749
+ },
750
+ finalized: false,
751
+ error: undefined,
752
+ render: [Function: render],
753
+ setLayout: [Function: setLayout],
754
+ getLayout: [Function: getLayout],
755
+ setRenderer: [Function: setRenderer],
756
+ header: [Function: header],
757
+ status: [Function: status],
758
+ set: [Function: set],
759
+ get: [Function: get],
760
+ newResponse: [Function: newResponse],
761
+ body: [Function: body],
762
+ text: [Function: text],
763
+ json: [Function: json],
764
+ html: [Function: html],
765
+ redirect: [Function: redirect],
766
+ notFound: [Function: notFound],
767
+ executionCtx: [Getter]
768
+ }): {
769
+ success: true,
770
+ data: {
771
+ session: {
772
+ id: 'rC1URIvi1B4GOxdWcwGGVqJ9OJeLdbKR',
773
+ createdAt: '2026-03-26T14:56:07.409Z',
774
+ updatedAt: '2026-03-26T14:56:07.409Z',
775
+ userId: 'rke3xED2HXvZZXixzDxC94OraRtrGC1A',
776
+ expiresAt: '2026-04-02T14:56:07.409Z',
777
+ token: 'xi9vv1y6t2PrBhBMHTO5OsRNcdKsvClC',
778
+ ipAddress: '127.0.0.1'
779
+ },
780
+ user: {
781
+ id: 'rke3xED2HXvZZXixzDxC94OraRtrGC1A',
782
+ createdAt: '2026-03-26T14:56:07.306Z',
783
+ updatedAt: '2026-03-26T14:56:07.306Z',
784
+ email: 'duplicate-prevention@email.com',
785
+ emailVerified: false,
786
+ name: 'Test User',
787
+ stripeCustomerId: 'cus_mock123'
788
+ }
789
+ }
790
+ }
791
+
792
+ stdout | src/stripe.test.ts > stripe > should prevent duplicate subscriptions with same plan and same seats
793
+ 1.83ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
794
+ customFetchImpl: [AsyncFunction: customFetchImpl],
795
+ body: '{"plan":"starter","seats":3}',
796
+ method: 'POST',
797
+ headers: Headers {
798
+ cookie: 'faire-auth.session_token=xi9vv1y6t2PrBhBMHTO5OsRNcdKsvClC.HvfzY2Coz768SxKlbwdyec9y5mdgbIBuJ7Oy1khkIKc%3D',
799
+ 'Content-Type': 'application/json'
800
+ },
801
+ onSuccess: [AsyncFunction: onSuccess]
802
+ }): {
803
+ data: null,
804
+ error: {
805
+ success: false,
806
+ message: "You're already subscribed to this plan",
807
+ status: 400,
808
+ statusText: ''
809
+ }
810
+ }
811
+
812
+ stdout | src/stripe.test.ts > stripe > should only call Stripe customers.create once for signup and upgrade
813
+ 116.18ms fetch('http://localhost:3000/api/auth/sign-up/email', {
814
+ customFetchImpl: [AsyncFunction: customFetchImpl],
815
+ body: '{"email":"single-create@email.com","password":"password","name":"Test User"}',
816
+ method: 'POST',
817
+ headers: Headers { 'Content-Type': 'application/json' },
818
+ onSuccess: [AsyncFunction: onSuccess]
819
+ }): {
820
+ data: {
821
+ success: true,
822
+ data: {
823
+ success: true,
824
+ token: '5wiyUrmD1Sdorjp68UwJthNFDSNldSnc',
825
+ user: [Object],
826
+ redirect: false,
827
+ url: null
828
+ }
829
+ },
830
+ error: null
831
+ }
832
+
833
+ stdout | src/stripe.test.ts > stripe > should only call Stripe customers.create once for signup and upgrade
834
+ 84.80ms fetch('http://localhost:3000/api/auth/sign-in/email', {
835
+ customFetchImpl: [AsyncFunction: customFetchImpl],
836
+ onSuccess: [AsyncFunction: onSuccess],
837
+ body: '{"email":"single-create@email.com","password":"password","name":"Test User"}',
838
+ method: 'POST',
839
+ headers: Headers { 'Content-Type': 'application/json' }
840
+ }): {
841
+ data: {
842
+ success: true,
843
+ data: {
844
+ success: true,
845
+ token: 'wwZSg9ocAiuNgskyxJcUntsT3Ut1kWbN',
846
+ user: [Object],
847
+ redirect: false,
848
+ url: null
849
+ }
850
+ },
851
+ error: null
852
+ }
853
+
854
+ stdout | src/stripe.test.ts > stripe > should only call Stripe customers.create once for signup and upgrade
855
+ 0.54ms getSession({ query: {} }, Context {
856
+ env: {
857
+ FAIRE_AUTH_SECRET: [Getter],
858
+ AUTH_SECRET: [Getter],
859
+ FAIRE_AUTH_TELEMETRY: [Getter],
860
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
861
+ NODE_ENV: [Getter],
862
+ PACKAGE_VERSION: [Getter],
863
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
864
+ },
865
+ finalized: false,
866
+ error: undefined,
867
+ render: [Function: render],
868
+ setLayout: [Function: setLayout],
869
+ getLayout: [Function: getLayout],
870
+ setRenderer: [Function: setRenderer],
871
+ header: [Function: header],
872
+ status: [Function: status],
873
+ set: [Function: set],
874
+ get: [Function: get],
875
+ newResponse: [Function: newResponse],
876
+ body: [Function: body],
877
+ text: [Function: text],
878
+ json: [Function: json],
879
+ html: [Function: html],
880
+ redirect: [Function: redirect],
881
+ notFound: [Function: notFound],
882
+ executionCtx: [Getter]
883
+ }): {
884
+ success: true,
885
+ data: {
886
+ session: {
887
+ id: 'p6AO1Iirf1s2eL2QFCLdIw6UHAkFR637',
888
+ createdAt: '2026-03-26T14:56:07.616Z',
889
+ updatedAt: '2026-03-26T14:56:07.616Z',
890
+ userId: 'Rsr550Sdu6U01vPZOq1njHxtB3oDzzS6',
891
+ expiresAt: '2026-04-02T14:56:07.616Z',
892
+ token: 'wwZSg9ocAiuNgskyxJcUntsT3Ut1kWbN',
893
+ ipAddress: '127.0.0.1'
894
+ },
895
+ user: {
896
+ id: 'Rsr550Sdu6U01vPZOq1njHxtB3oDzzS6',
897
+ createdAt: '2026-03-26T14:56:07.531Z',
898
+ updatedAt: '2026-03-26T14:56:07.531Z',
899
+ email: 'single-create@email.com',
900
+ emailVerified: false,
901
+ name: 'Test User',
902
+ stripeCustomerId: 'cus_mock123'
903
+ }
904
+ }
905
+ }
906
+
907
+ stdout | src/stripe.test.ts > stripe > should only call Stripe customers.create once for signup and upgrade
908
+ 1.61ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
909
+ customFetchImpl: [AsyncFunction: customFetchImpl],
910
+ body: '{"plan":"starter"}',
911
+ method: 'POST',
912
+ headers: Headers {
913
+ cookie: 'faire-auth.session_token=wwZSg9ocAiuNgskyxJcUntsT3Ut1kWbN.XrCC1fkIsiou%2B1eJNxMf%2B6vSOsp342ETT8I%2BudclMYA%3D',
914
+ 'Content-Type': 'application/json'
915
+ },
916
+ onSuccess: [AsyncFunction: onSuccess]
917
+ }): {
918
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
919
+ error: null
920
+ }
921
+
922
+ stdout | src/stripe.test.ts > stripe > should create billing portal session
923
+ 89.02ms fetch('http://localhost:3000/api/auth/sign-up/email', {
924
+ customFetchImpl: [AsyncFunction: customFetchImpl],
925
+ body: '{"email":"billing-portal@email.com","password":"password","name":"Test User"}',
926
+ method: 'POST',
927
+ headers: Headers { 'Content-Type': 'application/json' },
928
+ onSuccess: [AsyncFunction: onSuccess]
929
+ }): {
930
+ data: {
931
+ success: true,
932
+ data: {
933
+ success: true,
934
+ token: 'Ly7zIiKZkHeaGn5Uq0pK2LSE1CEBRpeV',
935
+ user: [Object],
936
+ redirect: false,
937
+ url: null
938
+ }
939
+ },
940
+ error: null
941
+ }
942
+
943
+ stdout | src/stripe.test.ts > stripe > should create billing portal session
944
+ 85.91ms fetch('http://localhost:3000/api/auth/sign-in/email', {
945
+ customFetchImpl: [AsyncFunction: customFetchImpl],
946
+ onSuccess: [AsyncFunction: onSuccess],
947
+ body: '{"email":"billing-portal@email.com","password":"password","name":"Test User"}',
948
+ method: 'POST',
949
+ headers: Headers { 'Content-Type': 'application/json' }
950
+ }): {
951
+ data: {
952
+ success: true,
953
+ data: {
954
+ success: true,
955
+ token: '0p4sVWvfspkWN2CJwGTG3Azm0eScdzGq',
956
+ user: [Object],
957
+ redirect: false,
958
+ url: null
959
+ }
960
+ },
961
+ error: null
962
+ }
963
+
964
+ stdout | src/stripe.test.ts > stripe > should create billing portal session
965
+ 0.38ms getSession({ query: {} }, Context {
966
+ env: {
967
+ FAIRE_AUTH_SECRET: [Getter],
968
+ AUTH_SECRET: [Getter],
969
+ FAIRE_AUTH_TELEMETRY: [Getter],
970
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
971
+ NODE_ENV: [Getter],
972
+ PACKAGE_VERSION: [Getter],
973
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
974
+ },
975
+ finalized: false,
976
+ error: undefined,
977
+ render: [Function: render],
978
+ setLayout: [Function: setLayout],
979
+ getLayout: [Function: getLayout],
980
+ setRenderer: [Function: setRenderer],
981
+ header: [Function: header],
982
+ status: [Function: status],
983
+ set: [Function: set],
984
+ get: [Function: get],
985
+ newResponse: [Function: newResponse],
986
+ body: [Function: body],
987
+ text: [Function: text],
988
+ json: [Function: json],
989
+ html: [Function: html],
990
+ redirect: [Function: redirect],
991
+ notFound: [Function: notFound],
992
+ executionCtx: [Getter]
993
+ }): {
994
+ success: true,
995
+ data: {
996
+ session: {
997
+ id: 'TgVHUB8xilbHtRdHKzj1GkgGJJIdfV7U',
998
+ createdAt: '2026-03-26T14:56:07.794Z',
999
+ updatedAt: '2026-03-26T14:56:07.794Z',
1000
+ userId: 'VoXv4fNiUXrzDz99YXiDt87MVFkKR0UN',
1001
+ expiresAt: '2026-04-02T14:56:07.794Z',
1002
+ token: '0p4sVWvfspkWN2CJwGTG3Azm0eScdzGq',
1003
+ ipAddress: '127.0.0.1'
1004
+ },
1005
+ user: {
1006
+ id: 'VoXv4fNiUXrzDz99YXiDt87MVFkKR0UN',
1007
+ createdAt: '2026-03-26T14:56:07.707Z',
1008
+ updatedAt: '2026-03-26T14:56:07.708Z',
1009
+ email: 'billing-portal@email.com',
1010
+ emailVerified: false,
1011
+ name: 'Test User',
1012
+ stripeCustomerId: 'cus_mock123'
1013
+ }
1014
+ }
1015
+ }
1016
+
1017
+ stdout | src/stripe.test.ts > stripe > should create billing portal session
1018
+ 1.36ms fetch('http://localhost:3000/api/auth/subscription/billing-portal', {
1019
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1020
+ body: '{"returnUrl":"/dashboard"}',
1021
+ method: 'POST',
1022
+ headers: Headers {
1023
+ cookie: 'faire-auth.session_token=0p4sVWvfspkWN2CJwGTG3Azm0eScdzGq.hpNXS7mixyLJK20BeoowVOOdWkQKBd1QDMPv1k5eMRY%3D',
1024
+ 'Content-Type': 'application/json'
1025
+ },
1026
+ onSuccess: [AsyncFunction: onSuccess]
1027
+ }): {
1028
+ data: { url: 'https://billing.stripe.com/mock', redirect: true },
1029
+ error: null
1030
+ }
1031
+
1032
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1033
+ 90.22ms fetch('http://localhost:3000/api/auth/sign-up/email', {
1034
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1035
+ body: '{"email":"org-ref@email.com","password":"password","name":"Test User"}',
1036
+ method: 'POST',
1037
+ headers: Headers { 'Content-Type': 'application/json' },
1038
+ onSuccess: [AsyncFunction: onSuccess]
1039
+ }): {
1040
+ data: {
1041
+ success: true,
1042
+ data: {
1043
+ success: true,
1044
+ token: 'Bv6biebxVUjBNZA2OK0syv5YAaUqEPP3',
1045
+ user: [Object],
1046
+ redirect: false,
1047
+ url: null
1048
+ }
1049
+ },
1050
+ error: null
1051
+ }
1052
+
1053
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1054
+ 87.18ms fetch('http://localhost:3000/api/auth/sign-in/email', {
1055
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1056
+ onSuccess: [AsyncFunction: onSuccess],
1057
+ body: '{"email":"org-ref@email.com","password":"password","name":"Test User"}',
1058
+ method: 'POST',
1059
+ headers: Headers { 'Content-Type': 'application/json' }
1060
+ }): {
1061
+ data: {
1062
+ success: true,
1063
+ data: {
1064
+ success: true,
1065
+ token: 't3XQb5niOfQIt8u4soJs9bXhondw3IQE',
1066
+ user: [Object],
1067
+ redirect: false,
1068
+ url: null
1069
+ }
1070
+ },
1071
+ error: null
1072
+ }
1073
+
1074
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1075
+ 0.44ms getSession({ query: {} }, Context {
1076
+ env: {
1077
+ FAIRE_AUTH_SECRET: [Getter],
1078
+ AUTH_SECRET: [Getter],
1079
+ FAIRE_AUTH_TELEMETRY: [Getter],
1080
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
1081
+ NODE_ENV: [Getter],
1082
+ PACKAGE_VERSION: [Getter],
1083
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
1084
+ },
1085
+ finalized: false,
1086
+ error: undefined,
1087
+ render: [Function: render],
1088
+ setLayout: [Function: setLayout],
1089
+ getLayout: [Function: getLayout],
1090
+ setRenderer: [Function: setRenderer],
1091
+ header: [Function: header],
1092
+ status: [Function: status],
1093
+ set: [Function: set],
1094
+ get: [Function: get],
1095
+ newResponse: [Function: newResponse],
1096
+ body: [Function: body],
1097
+ text: [Function: text],
1098
+ json: [Function: json],
1099
+ html: [Function: html],
1100
+ redirect: [Function: redirect],
1101
+ notFound: [Function: notFound],
1102
+ executionCtx: [Getter]
1103
+ }): {
1104
+ success: true,
1105
+ data: {
1106
+ session: {
1107
+ id: '6eyGhdaQscRDlSZXhgoi3EFpJ5ZTqOdo',
1108
+ createdAt: '2026-03-26T14:56:07.978Z',
1109
+ updatedAt: '2026-03-26T14:56:07.978Z',
1110
+ userId: '4xOPAN1Rh0wGHQ5rNoO9cQmtljn8BGX8',
1111
+ expiresAt: '2026-04-02T14:56:07.978Z',
1112
+ token: 't3XQb5niOfQIt8u4soJs9bXhondw3IQE',
1113
+ ipAddress: '127.0.0.1'
1114
+ },
1115
+ user: {
1116
+ id: '4xOPAN1Rh0wGHQ5rNoO9cQmtljn8BGX8',
1117
+ createdAt: '2026-03-26T14:56:07.890Z',
1118
+ updatedAt: '2026-03-26T14:56:07.890Z',
1119
+ email: 'org-ref@email.com',
1120
+ emailVerified: false,
1121
+ name: 'Test User',
1122
+ stripeCustomerId: 'cus_mock123'
1123
+ }
1124
+ }
1125
+ }
1126
+
1127
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1128
+ 1.58ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
1129
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1130
+ body: '{"plan":"starter"}',
1131
+ method: 'POST',
1132
+ headers: Headers {
1133
+ cookie: 'faire-auth.session_token=t3XQb5niOfQIt8u4soJs9bXhondw3IQE.9mzV6WUBLppggN7sYf8uZx90TnyQKtvGEjgNPcFi4SQ%3D',
1134
+ 'Content-Type': 'application/json'
1135
+ },
1136
+ onSuccess: [AsyncFunction: onSuccess]
1137
+ }): {
1138
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1139
+ error: null
1140
+ }
1141
+
1142
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1143
+ 0.39ms getSession({ query: {} }, Context {
1144
+ env: {
1145
+ FAIRE_AUTH_SECRET: [Getter],
1146
+ AUTH_SECRET: [Getter],
1147
+ FAIRE_AUTH_TELEMETRY: [Getter],
1148
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
1149
+ NODE_ENV: [Getter],
1150
+ PACKAGE_VERSION: [Getter],
1151
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
1152
+ },
1153
+ finalized: false,
1154
+ error: undefined,
1155
+ render: [Function: render],
1156
+ setLayout: [Function: setLayout],
1157
+ getLayout: [Function: getLayout],
1158
+ setRenderer: [Function: setRenderer],
1159
+ header: [Function: header],
1160
+ status: [Function: status],
1161
+ set: [Function: set],
1162
+ get: [Function: get],
1163
+ newResponse: [Function: newResponse],
1164
+ body: [Function: body],
1165
+ text: [Function: text],
1166
+ json: [Function: json],
1167
+ html: [Function: html],
1168
+ redirect: [Function: redirect],
1169
+ notFound: [Function: notFound],
1170
+ executionCtx: [Getter]
1171
+ }): {
1172
+ success: true,
1173
+ data: {
1174
+ session: {
1175
+ id: '6eyGhdaQscRDlSZXhgoi3EFpJ5ZTqOdo',
1176
+ createdAt: '2026-03-26T14:56:07.978Z',
1177
+ updatedAt: '2026-03-26T14:56:07.978Z',
1178
+ userId: '4xOPAN1Rh0wGHQ5rNoO9cQmtljn8BGX8',
1179
+ expiresAt: '2026-04-02T14:56:07.978Z',
1180
+ token: 't3XQb5niOfQIt8u4soJs9bXhondw3IQE',
1181
+ ipAddress: '127.0.0.1'
1182
+ },
1183
+ user: {
1184
+ id: '4xOPAN1Rh0wGHQ5rNoO9cQmtljn8BGX8',
1185
+ createdAt: '2026-03-26T14:56:07.890Z',
1186
+ updatedAt: '2026-03-26T14:56:07.890Z',
1187
+ email: 'org-ref@email.com',
1188
+ emailVerified: false,
1189
+ name: 'Test User',
1190
+ stripeCustomerId: 'cus_mock123'
1191
+ }
1192
+ }
1193
+ }
1194
+
1195
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1196
+ 1.34ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
1197
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1198
+ body: '{"plan":"starter","referenceId":"org_b67GF32Cljh7u588AuEblmLVobclDRcP"}',
1199
+ method: 'POST',
1200
+ headers: Headers {
1201
+ cookie: 'faire-auth.session_token=t3XQb5niOfQIt8u4soJs9bXhondw3IQE.9mzV6WUBLppggN7sYf8uZx90TnyQKtvGEjgNPcFi4SQ%3D',
1202
+ 'Content-Type': 'application/json'
1203
+ },
1204
+ onSuccess: [AsyncFunction: onSuccess]
1205
+ }): {
1206
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1207
+ error: null
1208
+ }
1209
+
1210
+ stdout | src/stripe.test.ts > stripe > should not update personal subscription when upgrading with an org referenceId
1211
+ {
1212
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1213
+ error: null
1214
+ }
1215
+
1216
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials for the same user
1217
+ 101.24ms fetch('http://localhost:3000/api/auth/sign-up/email', {
1218
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1219
+ body: '{"email":"trial-prevention@email.com","password":"password","name":"Test User"}',
1220
+ method: 'POST',
1221
+ headers: Headers { 'Content-Type': 'application/json' },
1222
+ onSuccess: [AsyncFunction: onSuccess]
1223
+ }): {
1224
+ data: {
1225
+ success: true,
1226
+ data: {
1227
+ success: true,
1228
+ token: 'GRd4xoOxclKwsYzf22r3M731MrcleGGX',
1229
+ user: [Object],
1230
+ redirect: false,
1231
+ url: null
1232
+ }
1233
+ },
1234
+ error: null
1235
+ }
1236
+
1237
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials for the same user
1238
+ 103.81ms fetch('http://localhost:3000/api/auth/sign-in/email', {
1239
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1240
+ onSuccess: [AsyncFunction: onSuccess],
1241
+ body: '{"email":"trial-prevention@email.com","password":"password","name":"Test User"}',
1242
+ method: 'POST',
1243
+ headers: Headers { 'Content-Type': 'application/json' }
1244
+ }): {
1245
+ data: {
1246
+ success: true,
1247
+ data: {
1248
+ success: true,
1249
+ token: 'y3IaC3eV6fhEWm1tW5gdGkjzhjWBVVNd',
1250
+ user: [Object],
1251
+ redirect: false,
1252
+ url: null
1253
+ }
1254
+ },
1255
+ error: null
1256
+ }
1257
+
1258
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials for the same user
1259
+ 0.46ms getSession({ query: {} }, Context {
1260
+ env: {
1261
+ FAIRE_AUTH_SECRET: [Getter],
1262
+ AUTH_SECRET: [Getter],
1263
+ FAIRE_AUTH_TELEMETRY: [Getter],
1264
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
1265
+ NODE_ENV: [Getter],
1266
+ PACKAGE_VERSION: [Getter],
1267
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
1268
+ },
1269
+ finalized: false,
1270
+ error: undefined,
1271
+ render: [Function: render],
1272
+ setLayout: [Function: setLayout],
1273
+ getLayout: [Function: getLayout],
1274
+ setRenderer: [Function: setRenderer],
1275
+ header: [Function: header],
1276
+ status: [Function: status],
1277
+ set: [Function: set],
1278
+ get: [Function: get],
1279
+ newResponse: [Function: newResponse],
1280
+ body: [Function: body],
1281
+ text: [Function: text],
1282
+ json: [Function: json],
1283
+ html: [Function: html],
1284
+ redirect: [Function: redirect],
1285
+ notFound: [Function: notFound],
1286
+ executionCtx: [Getter]
1287
+ }): {
1288
+ success: true,
1289
+ data: {
1290
+ session: {
1291
+ id: 'acOhIRrb4ntze1KVlOHH5PaMKfwpHjc4',
1292
+ createdAt: '2026-03-26T14:56:08.188Z',
1293
+ updatedAt: '2026-03-26T14:56:08.188Z',
1294
+ userId: 'GwSgLqjp5vowqsuO7Vm5WvQ0fa4Qq0Uj',
1295
+ expiresAt: '2026-04-02T14:56:08.188Z',
1296
+ token: 'y3IaC3eV6fhEWm1tW5gdGkjzhjWBVVNd',
1297
+ ipAddress: '127.0.0.1'
1298
+ },
1299
+ user: {
1300
+ id: 'GwSgLqjp5vowqsuO7Vm5WvQ0fa4Qq0Uj',
1301
+ createdAt: '2026-03-26T14:56:08.083Z',
1302
+ updatedAt: '2026-03-26T14:56:08.083Z',
1303
+ email: 'trial-prevention@email.com',
1304
+ emailVerified: false,
1305
+ name: 'Test User',
1306
+ stripeCustomerId: 'cus_mock123'
1307
+ }
1308
+ }
1309
+ }
1310
+
1311
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials for the same user
1312
+ 1.41ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
1313
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1314
+ body: '{"plan":"starter"}',
1315
+ method: 'POST',
1316
+ headers: Headers {
1317
+ cookie: 'faire-auth.session_token=y3IaC3eV6fhEWm1tW5gdGkjzhjWBVVNd.eSxtPV3v6%2FaosxgpgI%2F5Bgn6Pj46vVBmn7y1oc7lqSA%3D',
1318
+ 'Content-Type': 'application/json'
1319
+ },
1320
+ onSuccess: [AsyncFunction: onSuccess]
1321
+ }): {
1322
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1323
+ error: null
1324
+ }
1325
+
1326
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials for the same user
1327
+ 0.37ms getSession({ query: {} }, Context {
1328
+ env: {
1329
+ FAIRE_AUTH_SECRET: [Getter],
1330
+ AUTH_SECRET: [Getter],
1331
+ FAIRE_AUTH_TELEMETRY: [Getter],
1332
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
1333
+ NODE_ENV: [Getter],
1334
+ PACKAGE_VERSION: [Getter],
1335
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
1336
+ },
1337
+ finalized: false,
1338
+ error: undefined,
1339
+ render: [Function: render],
1340
+ setLayout: [Function: setLayout],
1341
+ getLayout: [Function: getLayout],
1342
+ setRenderer: [Function: setRenderer],
1343
+ header: [Function: header],
1344
+ status: [Function: status],
1345
+ set: [Function: set],
1346
+ get: [Function: get],
1347
+ newResponse: [Function: newResponse],
1348
+ body: [Function: body],
1349
+ text: [Function: text],
1350
+ json: [Function: json],
1351
+ html: [Function: html],
1352
+ redirect: [Function: redirect],
1353
+ notFound: [Function: notFound],
1354
+ executionCtx: [Getter]
1355
+ }): {
1356
+ success: true,
1357
+ data: {
1358
+ session: {
1359
+ id: 'acOhIRrb4ntze1KVlOHH5PaMKfwpHjc4',
1360
+ createdAt: '2026-03-26T14:56:08.188Z',
1361
+ updatedAt: '2026-03-26T14:56:08.188Z',
1362
+ userId: 'GwSgLqjp5vowqsuO7Vm5WvQ0fa4Qq0Uj',
1363
+ expiresAt: '2026-04-02T14:56:08.188Z',
1364
+ token: 'y3IaC3eV6fhEWm1tW5gdGkjzhjWBVVNd',
1365
+ ipAddress: '127.0.0.1'
1366
+ },
1367
+ user: {
1368
+ id: 'GwSgLqjp5vowqsuO7Vm5WvQ0fa4Qq0Uj',
1369
+ createdAt: '2026-03-26T14:56:08.083Z',
1370
+ updatedAt: '2026-03-26T14:56:08.083Z',
1371
+ email: 'trial-prevention@email.com',
1372
+ emailVerified: false,
1373
+ name: 'Test User',
1374
+ stripeCustomerId: 'cus_mock123'
1375
+ }
1376
+ }
1377
+ }
1378
+
1379
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials for the same user
1380
+ 1.27ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
1381
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1382
+ body: '{"plan":"starter"}',
1383
+ method: 'POST',
1384
+ headers: Headers {
1385
+ cookie: 'faire-auth.session_token=y3IaC3eV6fhEWm1tW5gdGkjzhjWBVVNd.eSxtPV3v6%2FaosxgpgI%2F5Bgn6Pj46vVBmn7y1oc7lqSA%3D',
1386
+ 'Content-Type': 'application/json'
1387
+ },
1388
+ onSuccess: [AsyncFunction: onSuccess]
1389
+ }): {
1390
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1391
+ error: null
1392
+ }
1393
+
1394
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials across different plans
1395
+ 92.61ms fetch('http://localhost:3000/api/auth/sign-up/email', {
1396
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1397
+ body: '{"email":"cross-plan-trial@email.com","password":"password","name":"Test User"}',
1398
+ method: 'POST',
1399
+ headers: Headers { 'Content-Type': 'application/json' },
1400
+ onSuccess: [AsyncFunction: onSuccess]
1401
+ }): {
1402
+ data: {
1403
+ success: true,
1404
+ data: {
1405
+ success: true,
1406
+ token: 'q17uA0qtEadJEOLXFiKFctDJeYNR2pLn',
1407
+ user: [Object],
1408
+ redirect: false,
1409
+ url: null
1410
+ }
1411
+ },
1412
+ error: null
1413
+ }
1414
+
1415
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials across different plans
1416
+ 93.77ms fetch('http://localhost:3000/api/auth/sign-in/email', {
1417
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1418
+ onSuccess: [AsyncFunction: onSuccess],
1419
+ body: '{"email":"cross-plan-trial@email.com","password":"password","name":"Test User"}',
1420
+ method: 'POST',
1421
+ headers: Headers { 'Content-Type': 'application/json' }
1422
+ }): {
1423
+ data: {
1424
+ success: true,
1425
+ data: {
1426
+ success: true,
1427
+ token: '3IiSgwztiS0NingzTaY8omQMy5VTIiJ5',
1428
+ user: [Object],
1429
+ redirect: false,
1430
+ url: null
1431
+ }
1432
+ },
1433
+ error: null
1434
+ }
1435
+
1436
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials across different plans
1437
+ 0.45ms getSession({ query: {} }, Context {
1438
+ env: {
1439
+ FAIRE_AUTH_SECRET: [Getter],
1440
+ AUTH_SECRET: [Getter],
1441
+ FAIRE_AUTH_TELEMETRY: [Getter],
1442
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
1443
+ NODE_ENV: [Getter],
1444
+ PACKAGE_VERSION: [Getter],
1445
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
1446
+ },
1447
+ finalized: false,
1448
+ error: undefined,
1449
+ render: [Function: render],
1450
+ setLayout: [Function: setLayout],
1451
+ getLayout: [Function: getLayout],
1452
+ setRenderer: [Function: setRenderer],
1453
+ header: [Function: header],
1454
+ status: [Function: status],
1455
+ set: [Function: set],
1456
+ get: [Function: get],
1457
+ newResponse: [Function: newResponse],
1458
+ body: [Function: body],
1459
+ text: [Function: text],
1460
+ json: [Function: json],
1461
+ html: [Function: html],
1462
+ redirect: [Function: redirect],
1463
+ notFound: [Function: notFound],
1464
+ executionCtx: [Getter]
1465
+ }): {
1466
+ success: true,
1467
+ data: {
1468
+ session: {
1469
+ id: 'OeUFU4L9xDtYXotl1CTvdOHmHWScp2T0',
1470
+ createdAt: '2026-03-26T14:56:08.379Z',
1471
+ updatedAt: '2026-03-26T14:56:08.379Z',
1472
+ userId: '1X5aBGHQ2d6psgIkmBr5tlzK1X7ztPgo',
1473
+ expiresAt: '2026-04-02T14:56:08.379Z',
1474
+ token: '3IiSgwztiS0NingzTaY8omQMy5VTIiJ5',
1475
+ ipAddress: '127.0.0.1'
1476
+ },
1477
+ user: {
1478
+ id: '1X5aBGHQ2d6psgIkmBr5tlzK1X7ztPgo',
1479
+ createdAt: '2026-03-26T14:56:08.285Z',
1480
+ updatedAt: '2026-03-26T14:56:08.286Z',
1481
+ email: 'cross-plan-trial@email.com',
1482
+ emailVerified: false,
1483
+ name: 'Test User',
1484
+ stripeCustomerId: 'cus_mock123'
1485
+ }
1486
+ }
1487
+ }
1488
+
1489
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials across different plans
1490
+ 1.48ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
1491
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1492
+ body: '{"plan":"starter"}',
1493
+ method: 'POST',
1494
+ headers: Headers {
1495
+ cookie: 'faire-auth.session_token=3IiSgwztiS0NingzTaY8omQMy5VTIiJ5.jDXSkBSw4cBBPNEsI%2FvegzjzQXElPqQhl6tIWIcM1lg%3D',
1496
+ 'Content-Type': 'application/json'
1497
+ },
1498
+ onSuccess: [AsyncFunction: onSuccess]
1499
+ }): {
1500
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1501
+ error: null
1502
+ }
1503
+
1504
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials across different plans
1505
+ 0.40ms getSession({ query: {} }, Context {
1506
+ env: {
1507
+ FAIRE_AUTH_SECRET: [Getter],
1508
+ AUTH_SECRET: [Getter],
1509
+ FAIRE_AUTH_TELEMETRY: [Getter],
1510
+ FAIRE_AUTH_TELEMETRY_ID: [Getter],
1511
+ NODE_ENV: [Getter],
1512
+ PACKAGE_VERSION: [Getter],
1513
+ FAIRE_AUTH_TELEMETRY_ENDPOINT: [Getter]
1514
+ },
1515
+ finalized: false,
1516
+ error: undefined,
1517
+ render: [Function: render],
1518
+ setLayout: [Function: setLayout],
1519
+ getLayout: [Function: getLayout],
1520
+ setRenderer: [Function: setRenderer],
1521
+ header: [Function: header],
1522
+ status: [Function: status],
1523
+ set: [Function: set],
1524
+ get: [Function: get],
1525
+ newResponse: [Function: newResponse],
1526
+ body: [Function: body],
1527
+ text: [Function: text],
1528
+ json: [Function: json],
1529
+ html: [Function: html],
1530
+ redirect: [Function: redirect],
1531
+ notFound: [Function: notFound],
1532
+ executionCtx: [Getter]
1533
+ }): {
1534
+ success: true,
1535
+ data: {
1536
+ session: {
1537
+ id: 'OeUFU4L9xDtYXotl1CTvdOHmHWScp2T0',
1538
+ createdAt: '2026-03-26T14:56:08.379Z',
1539
+ updatedAt: '2026-03-26T14:56:08.379Z',
1540
+ userId: '1X5aBGHQ2d6psgIkmBr5tlzK1X7ztPgo',
1541
+ expiresAt: '2026-04-02T14:56:08.379Z',
1542
+ token: '3IiSgwztiS0NingzTaY8omQMy5VTIiJ5',
1543
+ ipAddress: '127.0.0.1'
1544
+ },
1545
+ user: {
1546
+ id: '1X5aBGHQ2d6psgIkmBr5tlzK1X7ztPgo',
1547
+ createdAt: '2026-03-26T14:56:08.285Z',
1548
+ updatedAt: '2026-03-26T14:56:08.286Z',
1549
+ email: 'cross-plan-trial@email.com',
1550
+ emailVerified: false,
1551
+ name: 'Test User',
1552
+ stripeCustomerId: 'cus_mock123'
1553
+ }
1554
+ }
1555
+ }
1556
+
1557
+ stdout | src/stripe.test.ts > stripe > should prevent multiple free trials across different plans
1558
+ 1.38ms fetch('http://localhost:3000/api/auth/subscription/upgrade', {
1559
+ customFetchImpl: [AsyncFunction: customFetchImpl],
1560
+ body: '{"plan":"premium"}',
1561
+ method: 'POST',
1562
+ headers: Headers {
1563
+ cookie: 'faire-auth.session_token=3IiSgwztiS0NingzTaY8omQMy5VTIiJ5.jDXSkBSw4cBBPNEsI%2FvegzjzQXElPqQhl6tIWIcM1lg%3D',
1564
+ 'Content-Type': 'application/json'
1565
+ },
1566
+ onSuccess: [AsyncFunction: onSuccess]
1567
+ }): {
1568
+ data: { url: 'https://checkout.stripe.com/mock', id: '', redirect: true },
1569
+ error: null
1570
+ }
1571
+
1572
+ ✓ src/stripe.test.ts (16 tests) 1920ms
1573
+
1574
+ Test Files 1 passed (1)
1575
+ Tests 16 passed (16)
1576
+ Start at 10:56:05
1577
+ Duration 3.23s (transform 456ms, setup 0ms, collect 979ms, tests 1.92s, environment 0ms, prepare 160ms)
1578
+