Skip to content

Commit

Permalink
fix: remove code for pushpad broadcast notifications that are not use…
Browse files Browse the repository at this point in the history
…d by novu
  • Loading branch information
collimarco committed Oct 13, 2023
1 parent 192beb3 commit 5b53c0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
7 changes: 1 addition & 6 deletions providers/pushpad/src/lib/pushpad.provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ test('should trigger pushpad library correctly', async () => {
});

const mockDeliverTo = jest.fn();
const mockBroadcast = jest.fn();
const mockBuildNotification = jest
.spyOn(provider, 'buildNotification' as any)
.mockReturnValue({
deliverTo: mockDeliverTo,
broadcast: mockBroadcast,
});
.mockReturnValue({ deliverTo: mockDeliverTo });

const result = await provider.sendMessage({
title: 'Test',
Expand All @@ -30,7 +26,6 @@ test('should trigger pushpad library correctly', async () => {

expect(mockBuildNotification).toHaveBeenCalled();
expect(mockDeliverTo).toHaveBeenCalledTimes(1);
expect(mockBroadcast).not.toHaveBeenCalled();

expect(result).toHaveProperty('id');
expect(result).toHaveProperty('date');
Expand Down
21 changes: 6 additions & 15 deletions providers/pushpad/src/lib/pushpad.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,12 @@ export class PushpadPushProvider implements IPushProvider {

let notificationId = null;

if (options.target) {
notification.deliverTo(options.target, function (err, result) {
if (err) {
throw Error(err);
}
notificationId = result.id;
});
} else {
notification.broadcast(function (err, result) {
if (err) {
throw Error(err);
}
notificationId = result.id;
});
}
notification.deliverTo(options.target, function (err, result) {
if (err) {
throw Error(err);
}
notificationId = result.id;
});

return {
id: notificationId,
Expand Down

0 comments on commit 5b53c0c

Please sign in to comment.