From a0377412a69b53697b5f21b9b83230f9e3e16a15 Mon Sep 17 00:00:00 2001 From: abhimanyu-fm Date: Sat, 24 Feb 2024 03:10:27 -0800 Subject: [PATCH] Add more cases as tests for parsing --- whatsapp-js/test/parseUsualQueueTest.js | 69 ++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/whatsapp-js/test/parseUsualQueueTest.js b/whatsapp-js/test/parseUsualQueueTest.js index 05c988d9..a2e46829 100644 --- a/whatsapp-js/test/parseUsualQueueTest.js +++ b/whatsapp-js/test/parseUsualQueueTest.js @@ -68,6 +68,43 @@ Please pay at https://razorpay.me/@Flickmatch `; +const message3 = `FlickMatch pick-up game at Lakeside Turf (https://goo.gl/maps/jvjUfqqcogZNMK8K6) +08:00 PM - 09:00 PM +23-02-2024 (Friday). +5v5 +₹200/- Per Person. + + +Add your name to the list: + +⚫ Black/Blue 🔵 + +1. Uday +2.Sarthak +3. +4. +5. + +⚪White/Red🔴 + 6.rahul + 7.rahul 1 +8.rahul 2 +9.gairik +9. Abhishrey +10.harsh + +Waitlist +1. +2. +3. +4. +5. + +Please pay at play.flickmatch.in/match-queues or +https://razorpay.me/@Flickmatch`; + +// console.log(parseMessage(message3)); + const expected = { isSuccessful: true, location: "Gallant Play Arena South City 1, Gurgaon", @@ -169,11 +206,39 @@ const expected2 = { ], }; +const expected3 = { + isSuccessful: true, + location: "Lakeside Turf", + startTime: "08:00 PM", + endTime: "09:00 PM", + date: "23-02-2024", + format: "5v5", + cost: "200", + listOfPlayers: [ + { name: "Uday" }, + { name: "Sarthak" }, + { name: "rahul" }, + { name: "rahul 1" }, + { name: "rahul 2" }, + { name: "gairik" }, + { name: "Abhishrey" }, + { name: "harsh" }, + ], + waitlist: [ + { name: "" }, + { name: "" }, + { name: "" }, + { name: "" }, + { name: "" }, + ], +}; + function assertEqual(actual, expected, label) { const areEqual = JSON.stringify(actual) === JSON.stringify(expected); // console.log(label, actual); console.assert(areEqual, `Assertion failed for ${label}:`, actual); } -assertEqual(parseMessage(message), expected, 'result'); -assertEqual(parseMessage(message2), expected2, 'result2'); +assertEqual(parseMessage(message), expected, "result"); +assertEqual(parseMessage(message2), expected2, "result2"); +assertEqual(parseMessage(message3), expected3, "result3");