From 97beaf0c1b9c9115e51cda09cbdaaf1680233156 Mon Sep 17 00:00:00 2001 From: kirrg001 Date: Mon, 30 Oct 2017 10:37:03 +0100 Subject: [PATCH] Tests: Fixed listeners_spec.js (DST) closes #9188 - make timezone offsets dynamic, yey! --- core/test/integration/model/base/listeners_spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/test/integration/model/base/listeners_spec.js b/core/test/integration/model/base/listeners_spec.js index 4e1016149d..bf0a1661cb 100644 --- a/core/test/integration/model/base/listeners_spec.js +++ b/core/test/integration/model/base/listeners_spec.js @@ -1,7 +1,7 @@ var should = require('should'), // jshint ignore:line sinon = require('sinon'), Promise = require('bluebird'), - moment = require('moment'), + moment = require('moment-timezone'), rewire = require('rewire'), _ = require('lodash'), config = require('../../../../server/config'), @@ -155,7 +155,7 @@ describe('Models: listeners', function () { * The post should be still scheduled for 8PM UTC time. * So the database UTC string must be 2017-04-19 20:00:00. */ - scope.timezoneOffset = 180; + scope.timezoneOffset = moment.tz.zone('Etc/UTC').offset(now) - moment.tz.zone('Asia/Baghdad').offset(now); scope.oldTimezone = 'Asia/Baghdad'; scope.newTimezone = 'Etc/UTC'; @@ -212,7 +212,7 @@ describe('Models: listeners', function () { * The post should be still scheduled for 8PM UTC time. * So the database UTC string must be 2017-04-18 11:00:00. */ - scope.timezoneOffset = -420; + scope.timezoneOffset = moment.tz.zone('Asia/Seoul').offset(now) - moment.tz.zone('Europe/Amsterdam').offset(now); scope.oldTimezone = 'Europe/Amsterdam'; scope.newTimezone = 'Asia/Seoul'; @@ -277,7 +277,7 @@ describe('Models: listeners', function () { }); }); - scope.timezoneOffset = -180; + scope.timezoneOffset = moment.tz.zone('Asia/Baghdad').offset(now) - moment.tz.zone('Etc/UTC').offset(now); scope.oldTimezone = 'Asia/Baghdad'; scope.newTimezone = 'Etc/UTC';