From 901f308cfca74604b6743095f36b4d69385f4d7d Mon Sep 17 00:00:00 2001 From: Josh Kasten Date: Tue, 14 Nov 2023 20:33:39 +0000 Subject: [PATCH] add test for notification click listner --- .../unit/notifications/eventListeners.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 __test__/unit/notifications/eventListeners.test.ts 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); + }); +});