diff --git a/__test__/unit/notifications/eventListeners.test.ts b/__test__/unit/notifications/eventListeners.test.ts new file mode 100644 index 000000000..5c86e7ecd --- /dev/null +++ b/__test__/unit/notifications/eventListeners.test.ts @@ -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); + }); +});