@@ -3,7 +3,11 @@ import { CopilotAPI } from '@/utils/CopilotAPI'
33import { TaskReminderType } from '@prisma/client'
44import { sendReminderEmail } from './send-reminder-email'
55
6- jest . mock ( '@/config' , ( ) => ( { reminderSubjectOverrideWorkspaces : new Set ( [ 'ws_override' ] ) } ) )
6+ jest . mock ( '@/config' , ( ) => ( {
7+ reminderSubjectOverrideWorkspaces : new Set ( [ 'ws_override' ] ) ,
8+ reminderSubjectSearch : ': Acme Bank' ,
9+ reminderSubjectReplacement : ':' ,
10+ } ) )
711
812const workspace : WorkspaceResponse = {
913 id : 'ws_1' ,
@@ -138,6 +142,23 @@ describe('sendReminderEmail', () => {
138142 expect ( payload . deliveryTargets . email . title ) . toBe ( 'View task' )
139143 } )
140144
145+ it ( 'strips the configured search phrase from the subject for override workspaces' , async ( ) => {
146+ const createNotification = jest . fn ( ) . mockResolvedValue ( { id : 'notif_6' , createdAt : '2026-05-25T00:00:00Z' } )
147+
148+ await sendReminderEmail ( {
149+ task : { ...task , title : 'Quarterly review: Acme Bank' } ,
150+ recipientClientId : 'client_1' ,
151+ recipientCompanyId : 'company_1' ,
152+ reminderType : TaskReminderType . DUE_DATE_OVERDUE_3D ,
153+ isCompanyRecipient : false ,
154+ workspace : { ...workspace , id : 'ws_override' } ,
155+ copilot : buildCopilotMock ( createNotification ) ,
156+ } )
157+
158+ const payload = createNotification . mock . calls [ 0 ] [ 0 ]
159+ expect ( payload . deliveryTargets . email . subject ) . toBe ( '[Overdue] Quarterly review:' )
160+ } )
161+
141162 it ( 'keeps the generic subject for workspaces not in the override set' , async ( ) => {
142163 const createNotification = jest . fn ( ) . mockResolvedValue ( { id : 'notif_5' , createdAt : '2026-05-25T00:00:00Z' } )
143164
0 commit comments