Skip to content

Commit

Permalink
Merge pull request #149 from flickmatch/logo-fix
Browse files Browse the repository at this point in the history
Add more cases as tests for parsing
  • Loading branch information
abhishekFlick authored Feb 28, 2024
2 parents fc1cdd5 + a037741 commit 3d2f298
Showing 1 changed file with 67 additions and 2 deletions.
69 changes: 67 additions & 2 deletions whatsapp-js/test/parseUsualQueueTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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");

0 comments on commit 3d2f298

Please sign in to comment.