From d4be542a91098a7bb7d699a5cae6b1465d0b39c1 Mon Sep 17 00:00:00 2001 From: Mohammed Ashab Uddin Date: Sat, 25 Jul 2020 21:17:11 +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..b0786b7 100644 --- a/whatsapp-web.js/test/test_command.js +++ b/whatsapp-web.js/test/test_command.js @@ -91,6 +91,21 @@ describe('Command', () => { }); + it.only('Test : equals() with different message', () => { + + let message = 'wg website web'; + + let a = new Command({ + command: "wg create ", + callback: () => { + + } + }); + + expect(a.equals(message)).to.false; + + }); + it('Test : equals() with spelling error', () => { let message = 'wg websit';