From cb3b817fc3430d966043e08fcb0c1aebc2f3a01b Mon Sep 17 00:00:00 2001 From: Dima Grossman Date: Wed, 28 Aug 2024 17:48:43 +0300 Subject: [PATCH] fix(worker): multi case method for fcm (#6405) --- packages/providers/src/lib/push/fcm/fcm.provider.spec.ts | 6 +++--- packages/providers/src/lib/push/fcm/fcm.provider.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/providers/src/lib/push/fcm/fcm.provider.spec.ts b/packages/providers/src/lib/push/fcm/fcm.provider.spec.ts index 344ad447516..fe98da1e890 100644 --- a/packages/providers/src/lib/push/fcm/fcm.provider.spec.ts +++ b/packages/providers/src/lib/push/fcm/fcm.provider.spec.ts @@ -4,7 +4,7 @@ import app from 'firebase-admin/app'; import { FcmPushProvider } from './fcm.provider'; -const sendMulticast = vi.fn().mockResolvedValue({ successCount: 1 }); +const sendEachForMulticast = vi.fn().mockResolvedValue({ successCount: 1 }); const mockApp = { appCheck: vi.fn() as any, auth: vi.fn() as any, @@ -31,7 +31,7 @@ vi.mock(import('firebase-admin/messaging'), async (importOriginal) => { sendEach: vi.fn(), sendEachForMulticast: vi.fn(), sendAll: vi.fn(), - sendMulticast, + sendEachForMulticast, sendToDevice: vi.fn(), sendToDeviceGroup: vi.fn(), sendToTopic: vi.fn(), @@ -87,7 +87,7 @@ describe.skip('FcmPushProvider', () => { spy = vi // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error - .spyOn(provider.messaging, 'sendMulticast') + .spyOn(provider.messaging, 'sendEachForMulticast') .mockImplementation(async () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any return {} as any; diff --git a/packages/providers/src/lib/push/fcm/fcm.provider.ts b/packages/providers/src/lib/push/fcm/fcm.provider.ts index 349fd4efa5f..0222d83dcf2 100644 --- a/packages/providers/src/lib/push/fcm/fcm.provider.ts +++ b/packages/providers/src/lib/push/fcm/fcm.provider.ts @@ -68,7 +68,7 @@ export class FcmPushProvider extends BaseProvider implements IPushProvider { let res; if (type === 'data') { - res = await this.messaging.sendMulticast( + res = await this.messaging.sendEachForMulticast( this.transform(bridgeProviderData, { tokens: options.target, data: { @@ -84,7 +84,7 @@ export class FcmPushProvider extends BaseProvider implements IPushProvider { }).body ); } else { - res = await this.messaging.sendMulticast( + res = await this.messaging.sendEachForMulticast( this.transform(bridgeProviderData, { tokens: options.target, notification: {