From 90a14a9e1b43aa4d7d9dd132781de48b7283a509 Mon Sep 17 00:00:00 2001 From: Mohammed Ashab Uddin Date: Sat, 25 Jul 2020 10:46:30 +0400 Subject: [PATCH 1/2] added default value to the object parameter --- whatsapp-web.js/src/models/product.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whatsapp-web.js/src/models/product.js b/whatsapp-web.js/src/models/product.js index 0878b60..8a01ddb 100644 --- a/whatsapp-web.js/src/models/product.js +++ b/whatsapp-web.js/src/models/product.js @@ -1,7 +1,7 @@ class Product { - constructor({ id = '', name = '', desc = '', cost = 0, image = null }) { + constructor({ id = '', name = '', desc = '', cost = 0, image = null } = {}) { this.id = id; this.name = name; this.desc = desc; From 416deb477c7e460a593e6ff6afff1dd8614b54e6 Mon Sep 17 00:00:00 2001 From: Mohammed Ashab Uddin Date: Sat, 25 Jul 2020 21:19:59 +0400 Subject: [PATCH 2/2] 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';