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