You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('flags the exact bank/card phishing sentence as high risk with expected tactics',()=>{
26
+
constmessage='We detected unauthorized login activity on your account. Your card is temporarily locked. Click here immediately to verify your identity.';
it('keeps a normal official student portal reminder low risk',()=>{
54
+
constresult=analyzeMessage({ ...base,context: 'admission',message: 'Your university orientation schedule is available in the official student portal.'});
55
+
expect(result.level).toBe('low');
56
+
});
57
+
58
+
it('does not over-score a legitimate scholarship deadline with official website guidance',()=>{
59
+
constresult=analyzeMessage({ ...base,context: 'scholarship',message: 'Reminder: the scholarship application deadline is Friday. Log in through the official university website.'});
60
+
expect(['low','medium']).toContain(result.level);
61
+
});
62
+
25
63
it('flags scholarship guarantee scams',()=>{
26
64
constresult=analyzeMessage({ ...base,context: 'scholarship',platform: 'WhatsApp',message: 'Congratulations dear applicant, full scholarship guaranteed. Pay processing fee today by mobile money.'});
message: 'Synthetic demo sample: We detected unauthorized login activity on your account. Your card is temporarily locked. Click here immediately to verify your identity.',
17
+
language: 'English',
18
+
countryRegion: 'Student/family country or region',
detectedTactics: detectedTactics.length ? detectedTactics : [{id: 'noStrongRule',label: 'No strong rule matched',description: 'The text did not match strong scam-risk indicators. Continue normal verification because legitimate messages can still be spoofed.',weight: 0,evidence: []}],
63
145
fakeAuthorityType: detectedTactics.some((x)=>x.id==='authorityImpersonation')||input.claimedAuthority ? authorityByContext[input.context] : 'No explicit authority detected, but verify any sender identity.',
64
-
sensitiveDataRisk: riskArea(sensitiveEvidence.length>0,finalScore,'Elevated: message appears to request identity, visa, login, school, or financial data.','No direct sensitive-data request detected in the text.',Array.from(newSet(sensitiveEvidence)).slice(0,5)),
65
-
paymentRisk: riskArea(paymentEvidence.length>0,finalScore,'Elevated: message references a fee, deposit, refund, tuition payment, or risky payment channel.','No direct payment request detected in the text.',Array.from(newSet(paymentEvidence)).slice(0,5)),
66
-
linkDomainRisk: riskArea(linkEvidence.length>0,finalScore,'Elevated: link, short link, chat link, or suspicious domain pattern detected.','No obvious link/domain pattern detected; still verify sender domains manually.',linkEvidence),
146
+
sensitiveDataRisk: riskArea(sensitiveEvidence.length>0,finalScore,'Elevated: message appears to request identity, visa, login, school, or financial data.','No direct sensitive-data request detected in the text.',sensitiveEvidence),
147
+
paymentRisk: riskArea(paymentEvidence.length>0,finalScore,'Elevated: message references a fee, deposit, refund, tuition payment, or risky payment channel.','No direct payment request detected in the text.',paymentEvidence),
148
+
linkDomainRisk: riskArea(linkEvidence.length>0||matchedIds.has('clickActionPressure'),finalScore,'Elevated: link, short link, chat link, suspicious domain pattern, or click/action language detected.','No obvious link/domain pattern detected; still verify sender domains manually.',linkEvidence.length ? linkEvidence : actionPressureEvidence),
149
+
accountSecurityRisk: riskArea(accountSecurityEvidence.length>0,finalScore,'Elevated: message claims unauthorized activity, account closure, or locked/suspended access.','No account lock, suspension, or unauthorized-login claim detected.',accountSecurityEvidence),
150
+
credentialRisk: riskArea(credentialEvidence.length>0,finalScore,'Elevated: message references passwords, OTPs, login codes, PINs, or 2FA details.','No password, OTP, PIN, or login-code request detected.',credentialEvidence),
151
+
financialAccountRisk: riskArea(financialAccountEvidence.length>0,finalScore,'Elevated: message references cards, bank accounts, transactions, refunds, charges, or fraud alerts.','No direct card, bank-account, transaction, refund, or charge language detected.',financialAccountEvidence),
152
+
actionPressureRisk: riskArea(actionPressureEvidence.length>0,finalScore,'Elevated: message pushes clicking, verifying now, restoring access, or immediate action.','No direct click/action pressure detected.',actionPressureEvidence),
67
153
crossBorderAdaptationPattern: detectedTactics.some((x)=>x.id==='crossBorderBureaucracyConfusion') ? 'The message mixes real cross-border education, visa, testing, payment, or document terms in a way that can pressure families unfamiliar with the destination-country process.' : 'No strong cross-border bureaucracy pattern detected, but students should still verify with official destination-country and institution channels.',
falsePositiveWarning: 'This tool reports risk indicators, not certainty. A legitimate message can contain deadlines or payment language; verify through official channels before acting.',
trustedAdultNote: 'If you are a minor or feel pressured, ask a trusted adult, parent/guardian, school counselor, or admissions adviser to review the message with you before responding.',
0 commit comments