Skip to content

Commit

Permalink
Merge pull request #35542 from ruben-rebelo/ts-migration/react-native…
Browse files Browse the repository at this point in the history
…-firebase-crashlytics-mock

[No QA][TS migration] Migrate @react-native-firebase/crashlytics mock
  • Loading branch information
marcochavezf authored Feb 7, 2024
2 parents 82e93b8 + 5af8103 commit f8988df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 0 additions & 7 deletions __mocks__/@react-native-firebase/crashlytics.js

This file was deleted.

15 changes: 15 additions & 0 deletions __mocks__/@react-native-firebase/crashlytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {FirebaseCrashlyticsTypes} from '@react-native-firebase/crashlytics';

type CrashlyticsModule = Pick<FirebaseCrashlyticsTypes.Module, 'log' | 'recordError' | 'setCrashlyticsCollectionEnabled'>;

type CrashlyticsMock = () => CrashlyticsModule;

// <App> uses <ErrorBoundary> and we need to mock the imported crashlytics module
// due to an error that happens otherwise https://github.com/invertase/react-native-firebase/issues/2475
const crashlyticsMock: CrashlyticsMock = () => ({
log: jest.fn(),
recordError: jest.fn(),
setCrashlyticsCollectionEnabled: jest.fn(),
});

export default crashlyticsMock;

0 comments on commit f8988df

Please sign in to comment.