Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export async function getNotificationCount() {
const {headers, json: notifications} = await getNotificationResponse({maxItems: 1});

const interval = Number(headers.get('X-Poll-Interval'));
const lastModified = (new Date(headers.get('Last-Modified'))).toISOString();
const lastModified = (new Date(headers.get('Last-Modified'))).toGMTString();
const linkHeader = headers.get('Link');

if (linkHeader === null) {
Expand Down
2 changes: 1 addition & 1 deletion source/lib/notifications-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function playNotificationSound() {
}

export async function checkNotifications(lastModified) {
let notifications = await getNotifications({lastModified});
let notifications = await getNotifications({lastModified: lastModified.toGMTString()});
const {showDesktopNotif, playNotifSound, filterNotifications} = await optionsStorage.getAll();

if (filterNotifications) {
Expand Down
6 changes: 3 additions & 3 deletions test/api-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ test.serial('#getNotificationCount promise resolves response of 0 notifications
global.fetch = fakeFetch();

const response = await service.getNotificationCount();
t.deepEqual(response, {count: 0, interval: 60, lastModified: '1970-01-01T00:00:00.000Z'});
t.deepEqual(response, {count: 0, interval: 60, lastModified: 'Thu, 01 Jan 1970 00:00:00 GMT'});
});

test.serial('#getNotificationCount promise resolves response of N notifications according to Link header', async t => {
Expand All @@ -168,7 +168,7 @@ test.serial('#getNotificationCount promise resolves response of N notifications
}
});

t.deepEqual(await service.getNotificationCount(), {count: 2, interval: 60, lastModified: '1970-01-01T00:00:00.000Z'});
t.deepEqual(await service.getNotificationCount(), {count: 2, interval: 60, lastModified: 'Thu, 01 Jan 1970 00:00:00 GMT'});

global.fetch = fakeFetch({
headers: {
Expand All @@ -179,7 +179,7 @@ test.serial('#getNotificationCount promise resolves response of N notifications
}
});

t.deepEqual(await service.getNotificationCount(), {count: 3, interval: 60, lastModified: '1970-01-01T00:00:00.000Z'});
t.deepEqual(await service.getNotificationCount(), {count: 3, interval: 60, lastModified: 'Thu, 01 Jan 1970 00:00:00 GMT'});
});

test.serial('#makeApiRequest returns rejected promise for 4xx status codes', async t => {
Expand Down