Skip to content

Commit 30bea55

Browse files
committed
test(billing): cover a trial reminder for an end date the trial no longer has
1 parent b079354 commit 30bea55

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎apps/sim/lib/billing/free-plan.integration.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,20 @@ describe('handleTrialWillEnd', () => {
303303

304304
await handleTrialWillEnd(event)
305305

306+
expect(mockSendEmail).not.toHaveBeenCalled()
307+
})
308+
it('sends nothing for a reminder about an end date the trial no longer has', async () => {
309+
const userId = await createUser()
310+
const stripeSubscriptionId = await addSubscription(userId, 'trialing')
311+
const event = trialWillEnd(stripeSubscriptionId)
312+
// Still trialing, but its end moved after this event was sent.
313+
liveSubscriptions.set(stripeSubscriptionId, {
314+
...event,
315+
trial_end: (event.trial_end ?? 0) + 7 * 86_400,
316+
})
317+
318+
await handleTrialWillEnd(event)
319+
306320
expect(mockSendEmail).not.toHaveBeenCalled()
307321
})
308322
})

0 commit comments

Comments
 (0)