Skip to content

Commit

Permalink
add test for notification click listner
Browse files Browse the repository at this point in the history
  • Loading branch information
jkasten2 committed Nov 14, 2023
1 parent 3070b39 commit 901f308
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions __test__/unit/notifications/eventListeners.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { TestEnvironment } from '../../support/environment/TestEnvironment';
import EventHelper from '../../../src/shared/helpers/EventHelper';

describe('Notification Events', () => {
beforeEach(async () => {
TestEnvironment.initialize();
});

afterEach(() => {
jest.resetAllMocks();
});

test('Adding click listener fires internal EventHelper', async () => {
const stub = test.stub(EventHelper, 'fireStoredNotificationClicks');
OneSignal.Notifications.addEventListener('click', null);
expect(stub).toHaveBeenCalledTimes(1);
});
});

0 comments on commit 901f308

Please sign in to comment.