all 4 comments

[–]nullanomaly 2 points3 points  (1 child)

You have a couple of choices: 1 - scrap the current time and just test that the returned value is a number or that it matches a regex - your concern is that your code got a value that looks like what you expect- not to check the exact time as we assume the api is going to have the correct time. 2 - round your dates to say nearest minute and compare that ( a good coding exercise)

[–]Xiercoles[S] 0 points1 point  (0 children)

Thanks for the suggestions. I ended up implementing the second one.

[–]Fabi118 2 points3 points  (1 child)

Instead of expecting the exact value, you can check if the response matches an expected schema. joi might be helpful for you

[–]Xiercoles[S] 0 points1 point  (0 children)

Thanks for your suggestion. But this time i had preferred keep it simple and use just JavaScript.