Timestamp Microservice fails working projects if the user's clock is set wrong
See original GitHub issueThe empty date tests (the last two tests) never succeed, even if meeting the tests demands. I’ve checked this manually using the browser with my Glitch project URL https://lean-shroud.glitch.me/api/timestamp/ which is to query the API with an empty date and it correctly returns the current datetime in Unix and UTC format.
I’ve checked the tests source:
getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp'').then(data => { var now = Date.now(); assert.approximately(data.unix, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); })
getUserInput => $.get(getUserInput(''url'') + ''/api/timestamp'').then(data => { var now = Date.now(); var serverTime = (new Date(data.utc)).getTime(); assert.approximately(serverTime, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); })
to make sure I’m returning the expected object with the “unix” and “utc” props and that they also contain the correct value, and they do, however, this line seems to fail assert.approximately...
.
- Browser Name: Google Chrome
- Browser Version: 72.0.3626.81 (Official build) (64 bits)
- Operating System: Windows 10 Pro
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (9 by maintainers)
Top GitHub Comments
Okay, I think your original idea
is mostly likely correct, since that would result in the tests failing without any logs. AssertionErrors are not reported to the console, since the site already tells you if a test is failing.
I’m not sure why this would be the case, but potentially your system clock is out of sync with Glitch, so is reporting a UTC that’s more than 20s away from the server time. So, first thing I would suggest is to synchronize your clock. If that doesn’t help, we can explore other options.
Sorry for the delay, yes, I will record a video as you asked.