Skip to content

Commit 42d1ba7

Browse files
committed
fix(emails): mock the module the limit-notification sender actually imports
1 parent 5d9388e commit 42d1ba7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/sim/lib/billing/core/limit-notifications.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ vi.mock('@/lib/messaging/email/mailer', () => ({ sendEmail: sendEmailSpy }))
2626
vi.mock('@/lib/messaging/email/unsubscribe', () => ({
2727
getEmailPreferences: getEmailPreferencesMock,
2828
}))
29-
vi.mock('@/components/emails/render', () => ({
29+
vi.mock('@/components/emails', () => ({
3030
renderLimitThresholdEmail: renderMock,
3131
getLimitEmailSubject: subjectMock,
3232
}))
@@ -72,6 +72,9 @@ describe('maybeSendLimitThresholdEmail', () => {
7272
expect(sendEmailSpy).toHaveBeenCalledTimes(1)
7373
expect(renderMock).toHaveBeenCalledWith(expect.objectContaining({ kind: 'warning' }))
7474
expect(subjectMock).toHaveBeenCalledWith('storage', 'warning')
75+
// Pins the subject to the shared helper's return, so a sender that builds
76+
// its own string — or a mock aimed at the wrong module path — fails here.
77+
expect(sendEmailSpy).toHaveBeenCalledWith(expect.objectContaining({ subject: 'Subject' }))
7578
})
7679

7780
it('sends a reached email at/over 100%', async () => {

0 commit comments

Comments
 (0)