From 416deb477c7e460a593e6ff6afff1dd8614b54e6 Mon Sep 17 00:00:00 2001 From: Mohammed Ashab Uddin Date: Sat, 25 Jul 2020 21:19:59 +0400 Subject: [PATCH] fixed bug in command.js --- whatsapp-web.js/src/models/commands.js | 2 +- whatsapp-web.js/test/test_command.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/whatsapp-web.js/src/models/commands.js b/whatsapp-web.js/src/models/commands.js index ab084c2..674a54b 100644 --- a/whatsapp-web.js/src/models/commands.js +++ b/whatsapp-web.js/src/models/commands.js @@ -45,7 +45,7 @@ class Command{ //else return false if(splitMsg[i] == splitCommand[i]){ continue; - }else if(splitCommand[i].match(/[<>]/g).length > 1){ + }else if(splitCommand[i].match(/[<>]/g) != null){ continue; }else{ return false; diff --git a/whatsapp-web.js/test/test_command.js b/whatsapp-web.js/test/test_command.js index 1fca64a..405a04d 100644 --- a/whatsapp-web.js/test/test_command.js +++ b/whatsapp-web.js/test/test_command.js @@ -91,6 +91,21 @@ describe('Command', () => { }); + it('Test : equals() with different message', () => { + + let message = 'wg website p12'; + + let a = new Command({ + command: "wg create ", + callback: () => { + + } + }); + + expect(a.equals(message)).to.false; + + }); + it('Test : equals() with spelling error', () => { let message = 'wg websit';