Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set permisssionLevel for notifications? #78

Open
hankypanky666 opened this issue May 29, 2018 · 0 comments
Open

How to set permisssionLevel for notifications? #78

hankypanky666 opened this issue May 29, 2018 · 0 comments

Comments

@hankypanky666
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant