diff --git a/honesty.js b/honesty.js index 86463c4..b4df176 100644 --- a/honesty.js +++ b/honesty.js @@ -1,9 +1,19 @@ +// The same promise in the future tense: "I'll let the team know", "I will flag this to support". +const WILL = "\\bi(?: will|['’]ll| am going to|['’]m going to) (?:also |just |now |go ahead and )?"; +const TEAM = '(?:the |our |a |an )?(?:omi )?(?:team|staff|support|engineers?|developers?|devs|person|human|someone)\\b'; + const LIE_PATTERNS = [ - /i('ve| have) (already )?(spoken|talked|reached out|messaged|emailed|pinged|informed|notified|escalated)/i, + /i(['’]ve| have) (already )?(spoken|talked|reached out|messaged|emailed|pinged|informed|notified|escalated)/i, + new RegExp(`${WILL}(?:let|tell|notify|inform|ping|alert|message|email|contact) ${TEAM}`, 'i'), + new RegExp( + `${WILL}(?:flag|forward|escalate|pass|send|raise|report|hand) (?:this|it|that|(?:your|the) \\w+)(?: (?:on|along|over|up))? (?:to|with|for) ${TEAM}`, + 'i' + ), + new RegExp(`${WILL}escalate\\b`, 'i'), /conveyed your (message|issue|problem)/i, /higher[- ]ups/i, /the (upper )?team has been (notified|informed)/i, - /i (will|I'll) (make sure|ensure) (the team|staff|someone)/i, + /\bi(?: will|['’]ll) (make sure|ensure) (the team|staff|someone)/i, /ticket has been (created|opened|filed)/i, /i (just )?contacted (support|staff|aarav|the team)/i, /passing this along/i, diff --git a/test/honesty.test.js b/test/honesty.test.js index ab41e52..8fcfc21 100644 --- a/test/honesty.test.js +++ b/test/honesty.test.js @@ -838,3 +838,31 @@ test('the same message id is only claimed once', () => { assert.equal(claimMessage('forum-starter-1'), false); assert.equal(claimMessage('forum-starter-2'), true); }); + +test('a promise to tell the team is a staff lie in the future tense too', () => { + for (const line of [ + "I'll make sure the team sees this.", + 'I’ll make sure someone gets back to you.', + "I'll let the team know about this.", + 'I will notify support right away.', + "I'll flag this to the team.", + "I'll forward this to support.", + "I'll escalate this for you.", + 'I am going to pass this on to the engineers.', + ]) { + assert.equal(looksLikeStaffLie(line), true, line); + assert.equal(stripStaffLies(`Restart the app first. ${line}`), 'Restart the app first.', line); + } +}); + +test('an offer the customer can act on is not a staff lie', () => { + for (const line of [ + "I'll tell you how to contact support.", + "I'll explain what the red light means.", + 'If that fails, let the team know in this thread.', + 'You can email help@omi.me and a person will look at it.', + 'I will send you the steps to reset the device.', + ]) { + assert.equal(looksLikeStaffLie(line), false, line); + } +});