From b0bef7999cf2b7a97495dcbdda53daa9ba1dba92 Mon Sep 17 00:00:00 2001 From: Benno Tielen Date: Thu, 16 Oct 2025 14:11:36 +0200 Subject: [PATCH] feature: minimal message length --- src/utils/detectSpam.test.ts | 6 ++++++ src/utils/detectSpam.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/utils/detectSpam.test.ts b/src/utils/detectSpam.test.ts index da2634c..7c2ed91 100644 --- a/src/utils/detectSpam.test.ts +++ b/src/utils/detectSpam.test.ts @@ -25,4 +25,10 @@ describe('isSpam function', () => { const result = isSpam(spamMessage); expect(result).toBe(false); }); + + it("should classify one word message as spam", () => { + const spamMessage = 'yolo'; + const result = isSpam(spamMessage); + expect(result).toBe(true) + }) }); \ No newline at end of file diff --git a/src/utils/detectSpam.ts b/src/utils/detectSpam.ts index 0a790ce..b8fe385 100644 --- a/src/utils/detectSpam.ts +++ b/src/utils/detectSpam.ts @@ -23,5 +23,9 @@ export const isSpam = (message: string): boolean => { return true; } + if (message.split(" ").length < 5) { + return true + } + return false; } \ No newline at end of file