@@ -3,8 +3,8 @@ import { vi } from 'vitest'
33/**
44 * Controllable mock functions for `@/lib/billing/webhooks/subscription-sync`. The enqueue
55 * functions resolve to a fixed event id; drive them with `mockResolvedValueOnce`.
6- * `mockIsSubscriptionSyncEventType` keeps the real logic; the `mockReadCommitted*` readers
7- * return the stored value they are given , as when nothing is in flight.
6+ * `mockIsSubscriptionSyncEventType` keeps the real logic; `mockReadCommittedSeats` and
7+ * `mockIsCancelAtPeriodEndSettled` answer from the stored value, as when nothing is in flight.
88 *
99 * @example
1010 * ```ts
@@ -33,8 +33,9 @@ export const billingSubscriptionSyncMockFns = {
3333 mockReconcileSubscriptionSyncFromStripe : vi . fn ( async ( ) => undefined ) ,
3434 mockRecordCustomerRestoreAfterHook : vi . fn ( async ( ) => undefined ) ,
3535 mockReadRecordedSyncValue : vi . fn ( async ( ) => undefined ) ,
36- mockReadCommittedCancelAtPeriodEnd : vi . fn (
37- async ( _tx : unknown , _subscriptionId : string , stored : boolean ) => stored
36+ mockIsCancelAtPeriodEndSettled : vi . fn (
37+ async ( _tx : unknown , _subscriptionId : string , stored : boolean , desired : boolean ) =>
38+ stored === desired
3839 ) ,
3940 mockReadCommittedSeats : vi . fn (
4041 async ( _tx : unknown , _subscriptionId : string , stored : number ) => stored
@@ -62,6 +63,6 @@ export const billingSubscriptionSyncMock = {
6263 billingSubscriptionSyncMockFns . mockReconcileSubscriptionSyncFromStripe ,
6364 recordCustomerRestoreAfterHook : billingSubscriptionSyncMockFns . mockRecordCustomerRestoreAfterHook ,
6465 readRecordedSyncValue : billingSubscriptionSyncMockFns . mockReadRecordedSyncValue ,
65- readCommittedCancelAtPeriodEnd : billingSubscriptionSyncMockFns . mockReadCommittedCancelAtPeriodEnd ,
66+ isCancelAtPeriodEndSettled : billingSubscriptionSyncMockFns . mockIsCancelAtPeriodEndSettled ,
6667 readCommittedSeats : billingSubscriptionSyncMockFns . mockReadCommittedSeats ,
6768}
0 commit comments