Skip to content

Commit 9db63a4

Browse files
maciej-kaacinader
authored andcommitted
fix: failing tests with dates in local time
1 parent d8f3fb1 commit 9db63a4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spec/PushController.spec.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,10 +1198,12 @@ describe('PushController', () => {
11981198
isLocalTime: false
11991199
})).toBe('2007-04-05T14:30:00.000Z', 'Timezone offset');
12001200

1201+
const noTimezone = new Date('2017-09-06T17:14:01.048')
1202+
const expectedHour = 17 + noTimezone.getTimezoneOffset() / 60;
12011203
expect(PushController.formatPushTime({
1202-
date: new Date('2017-09-06T17:14:01.048'),
1204+
date: noTimezone,
12031205
isLocalTime: true,
1204-
})).toBe('2017-09-06T17:14:01.048', 'No timezone');
1206+
})).toBe(`2017-09-06T${expectedHour}:14:01.048`, 'No timezone');
12051207
expect(PushController.formatPushTime({
12061208
date: new Date('2017-09-06'),
12071209
isLocalTime: true
@@ -1222,6 +1224,7 @@ describe('PushController', () => {
12221224
};
12231225

12241226
const pushTime = '2017-09-06T17:14:01.048';
1227+
const expectedHour = 17 + new Date(pushTime).getTimezoneOffset() / 60;
12251228

12261229
reconfigureServer({
12271230
push: {adapter: pushAdapter},
@@ -1247,7 +1250,7 @@ describe('PushController', () => {
12471250
})
12481251
.then((pushStatus) => {
12491252
expect(pushStatus.get('status')).toBe('scheduled');
1250-
expect(pushStatus.get('pushTime')).toBe('2017-09-06T17:14:01.048');
1253+
expect(pushStatus.get('pushTime')).toBe(`2017-09-06T${expectedHour}:14:01.048`);
12511254
})
12521255
.then(done, done.fail);
12531256
});

0 commit comments

Comments
 (0)