不要怂,就是干,撸起袖子干!

Commit 40348916 by Matt Broadstone

fix hardcoded timezone test

This test was dependent on a test having up to ~50ms of latency, which
is not necessarily guaranteed. This allows it to differ up to the actual
elapsed query time.
1 parent 22f0f451
Showing with 6 additions and 2 deletions
...@@ -20,12 +20,16 @@ if (dialect !== 'sqlite') { ...@@ -20,12 +20,16 @@ if (dialect !== 'sqlite') {
}); });
it('returns the same value for current timestamp', function () { it('returns the same value for current timestamp', function () {
var query = "SELECT now() as now"; var now = 'now()';
var query = "SELECT " + now + " as now";
var startQueryTime = Date.now();
return Promise.all([ return Promise.all([
this.sequelize.query(query), this.sequelize.query(query),
this.sequelizeWithTimezone.query(query) this.sequelizeWithTimezone.query(query)
]).spread(function (now1, now2) { ]).spread(function (now1, now2) {
expect(now1[0].now.getTime()).to.be.closeTo(now2[0].now.getTime(), 50); var elapsedQueryTime = Date.now() - startQueryTime;
expect(now1[0].now.getTime()).to.be.closeTo(now2[0].now.getTime(), elapsedQueryTime);
}); });
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!