From 8ba743aef4cc2eb6f84ce38e8cbc3e242d84cfcc Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 16 Nov 2025 13:52:05 -0500 Subject: [PATCH] test: improve native test Signed-off-by: Adam Setch --- src/renderer/utils/notifications/native.test.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/renderer/utils/notifications/native.test.ts b/src/renderer/utils/notifications/native.test.ts index 285300c96..97890e520 100644 --- a/src/renderer/utils/notifications/native.test.ts +++ b/src/renderer/utils/notifications/native.test.ts @@ -4,9 +4,17 @@ import { mockAccountNotifications, mockSingleAccountNotifications, } from '../../__mocks__/notifications-mocks'; +import * as helpers from '../helpers'; import * as native from './native'; describe('renderer/utils/notifications/native.ts', () => { + const mockHtmlUrl = + mockSingleAccountNotifications[0].notifications[0].repository.html_url; + + jest + .spyOn(helpers, 'generateGitHubWebUrl') + .mockImplementation(async () => mockHtmlUrl); + afterEach(() => { jest.clearAllMocks(); }); @@ -28,10 +36,9 @@ describe('renderer/utils/notifications/native.ts', () => { expect.stringContaining( mockSingleAccountNotifications[0].notifications[0].subject.title, ), - expect.stringContaining( - mockSingleAccountNotifications[0].notifications[0].repository.html_url, - ), + expect.stringContaining(mockHtmlUrl), ); + expect(helpers.generateGitHubWebUrl).toHaveBeenCalledTimes(1); }); it('should raise a native notification for multiple new notifications', async () => { @@ -46,5 +53,6 @@ describe('renderer/utils/notifications/native.ts', () => { 'You have 2 notifications', null, ); + expect(helpers.generateGitHubWebUrl).toHaveBeenCalledTimes(0); }); });