diff --git a/src/alertSearch/notify.ts b/src/alertSearch/notify.ts index a534376..1b3c74a 100644 --- a/src/alertSearch/notify.ts +++ b/src/alertSearch/notify.ts @@ -29,7 +29,8 @@ export type AlertSearchNotifyResult = { }; export function alertSearchNotificationBody(totalCount: number): string { - return `You have ${totalCount} new updates.`; + const noun = totalCount === 1 ? "update" : "updates"; + return `You have ${totalCount} new ${noun}.`; } export function buildAlertSearchNotificationContent( diff --git a/src/alertSearch/smsNotify.ts b/src/alertSearch/smsNotify.ts index 55a1f82..3a0d36d 100644 --- a/src/alertSearch/smsNotify.ts +++ b/src/alertSearch/smsNotify.ts @@ -46,8 +46,9 @@ export type AlertSearchSmsNotifyResult = { }; export function alertSearchSmsBody(totalCount: number): string { + const noun = totalCount === 1 ? "update" : "updates"; return ( - `Gift Economies: you have ${totalCount} new updates. ` + + `Gift Economies: you have ${totalCount} new ${noun}. ` + `${ALERT_SEARCH_SMS_LINK} Reply STOP to end.` ); } diff --git a/test/alertSearch/notify.test.ts b/test/alertSearch/notify.test.ts index c5bea85..bbe0689 100644 --- a/test/alertSearch/notify.test.ts +++ b/test/alertSearch/notify.test.ts @@ -151,7 +151,7 @@ describe("alertSearch notification gate", () => { assert.equal(content.type, ALERT_SEARCH_FCM_TYPE); assert.equal(content.body.includes(USER), false); assert.equal(content.body.includes("01H"), false); - assert.equal(alertSearchNotificationBody(1), "You have 1 new updates."); + assert.equal(alertSearchNotificationBody(1), "You have 1 new update."); }); }); diff --git a/test/alertSearch/smsNotify.test.ts b/test/alertSearch/smsNotify.test.ts index bd6c6c4..ab8da4c 100644 --- a/test/alertSearch/smsNotify.test.ts +++ b/test/alertSearch/smsNotify.test.ts @@ -124,6 +124,10 @@ describe("alertSearchSmsBody", () => { assert.ok( alertSearchSmsBody(999999).length <= SMS_SINGLE_SEGMENT_LIMIT ); + assert.equal( + alertSearchSmsBody(1), + `Gift Economies: you have 1 new update. ${ALERT_SEARCH_SMS_LINK} Reply STOP to end.` + ); assert.equal(body.includes("giftopia.tech"), false); }); });