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 2a4587c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions __test__/unit/notifications/eventListeners.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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',
null,
);
OneSignal.Notifications.addEventListener('click', null);
expect(stub).toHaveBeenCalledTimes(1);
});
});

0 comments on commit 2a4587c

Please sign in to comment.