-
Notifications
You must be signed in to change notification settings - Fork 2
Chai and Regex
Ben Weese edited this page Jul 6, 2019
·
1 revision
Postman uses Chai as a how it does its assertions for the test. So above is the link that will take you to the assertion library. This will help you figure it out.
One of those assertions are Match. You can use match and regex to define a format for a date or any other thing such as.
pm.expect(jsonData.date).to.be.match(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$/).and.to.be.a("string");
This sees if the date is a string that matches the formate 0000-00-00T00:00:00Z which is mysql format.