Open hankypanky666 opened 6 years ago
Hi! How to set permisssionLevel for notifications? I need to test this method:
export const notifyMessage = (payload): void => { const { hashId, date, messageId } = payload; chrome.notifications.getPermissionLevel((permissionLevel) => { console.log('permissionLevel: ', permissionLevel); if (permissionLevel === 'granted') { chrome.notifications.create(`${hashId}`, options, (id) => { console.log('notificationId: ', id); }); } }); };
and test:
describe('Notifications tests', () => { beforeAll(() => { global.chrome = chrome; }); it('notifyMessage', () => { notifyMessage(mockEmail); expect(chrome.notifications.getPermissionLevel.calledOnce).toBeTruthy(); }); afterAll(() => { delete global.chrome; }); });
I don`t understand why getPermissionLevel return 'denied'((( Plss help!
Hi! How to set permisssionLevel for notifications? I need to test this method:
and test:
I don`t understand why getPermissionLevel return 'denied'((( Plss help!