I need to test that a date in the body “tokenExpiry” is at least 24 hours from now. My initial thought was to set an environment variable from which to compare, but I suspect there might be an easier way?
var response = pm.response.json();
var tokenExpiry = response.tokenExpiry;
tokenExpiry = Date.parse(tokenExpiry);
var currentDate = new Date(Date.now());
var expectedDate = new Date(currentDate.setDate(currentDate.getDate() + 1));
expectedDate = Date.parse(expectedDate);
pm.expect(tokenExpiry).to.be.above(expectedDate);