Hello
I want to create a test that validates if the date format respects this: YYYY-MM-DD
in the body I have this answer:
βdateβ: β2021-10-29β
help me please
Hello
I want to create a test that validates if the date format respects this: YYYY-MM-DD
in the body I have this answer:
βdateβ: β2021-10-29β
help me please
@mld1954 Welcome to the community
Please refer the similar post discussed here.
Something like below would work too:
var jsonData = pm.response.json();
console.log(jsonData.data)
let date = jsonData.data;
let moment = require ('moment');
pm.test("Checking data format", function () {
pm.expect(date).to.include(moment(date).format('YYYY-MM-DD'));
});
Thank you very much @bpricilla