fix: failing tests with dates in local time

This commit is contained in:
maciej-ka
2017-12-02 12:31:16 +01:00
committed by Arthur Cinader
parent d8f3fb16bd
commit 9db63a4a50

View File

@@ -1198,10 +1198,12 @@ describe('PushController', () => {
isLocalTime: false
})).toBe('2007-04-05T14:30:00.000Z', 'Timezone offset');
const noTimezone = new Date('2017-09-06T17:14:01.048')
const expectedHour = 17 + noTimezone.getTimezoneOffset() / 60;
expect(PushController.formatPushTime({
date: new Date('2017-09-06T17:14:01.048'),
date: noTimezone,
isLocalTime: true,
})).toBe('2017-09-06T17:14:01.048', 'No timezone');
})).toBe(`2017-09-06T${expectedHour}:14:01.048`, 'No timezone');
expect(PushController.formatPushTime({
date: new Date('2017-09-06'),
isLocalTime: true
@@ -1222,6 +1224,7 @@ describe('PushController', () => {
};
const pushTime = '2017-09-06T17:14:01.048';
const expectedHour = 17 + new Date(pushTime).getTimezoneOffset() / 60;
reconfigureServer({
push: {adapter: pushAdapter},
@@ -1247,7 +1250,7 @@ describe('PushController', () => {
})
.then((pushStatus) => {
expect(pushStatus.get('status')).toBe('scheduled');
expect(pushStatus.get('pushTime')).toBe('2017-09-06T17:14:01.048');
expect(pushStatus.get('pushTime')).toBe(`2017-09-06T${expectedHour}:14:01.048`);
})
.then(done, done.fail);
});