Skip to content

Commit

Permalink
fix(worker): multi case method for fcm (#6405)
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy authored Aug 28, 2024
1 parent 02aa790 commit cb3b817
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/providers/src/lib/push/fcm/fcm.provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(),
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/providers/src/lib/push/fcm/fcm.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<MulticastMessage>(bridgeProviderData, {
tokens: options.target,
data: {
Expand All @@ -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<MulticastMessage>(bridgeProviderData, {
tokens: options.target,
notification: {
Expand Down

0 comments on commit cb3b817

Please sign in to comment.