Skip to content

Commit

Permalink
test: add persistNotification key to mock db
Browse files Browse the repository at this point in the history
  • Loading branch information
sherwinski committed Nov 27, 2024
1 parent de031c8 commit 5f24855
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions __test__/unit/sw/serviceWorker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe('ServiceWorker', () => {

// Mock Database methods
(Database.get as jest.Mock).mockResolvedValue({ value: true });
(Database.put as jest.Mock).mockResolvedValue({ value: false });
(Database.getAppConfig as jest.Mock).mockResolvedValue({ appId: 'test-app-id' });
});

Expand Down Expand Up @@ -241,13 +242,11 @@ describe('ServiceWorker', () => {
});

it('should set requireInteraction to false when persistNotification is false', async () => {
(Database.get as jest.Mock).mockResolvedValue({ value: false });

await Database.put('Options', { key: 'persistNotification', value: false });
await ServiceWorker.displayNotification({
body: '',
title: 'Test Title',
confirmDelivery: false,
notificationId: 'test-id'
notificationId: ''
});

expect(mockSelf.registration.showNotification).toHaveBeenCalledWith(
Expand Down

0 comments on commit 5f24855

Please sign in to comment.