Untitled

 avatar
unknown
plain_text
9 months ago
3.1 kB
2
Indexable
/* eslint-disable no-undef */
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';
import mock from 'react-native-permissions/mock';

require('react-native-reanimated/lib/reanimated2/jestUtils').setUpTests();
export * from '@react-native-async-storage/async-storage/jest/async-storage-mock';

jest.mock('react-native-device-info', () => mockRNDeviceInfo);

jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter');

jest.mock('@segment/analytics-react-native', () => ({
  setup: jest.fn,
  identify: jest.fn,
  reset: jest.fn,
}));

jest.mock('react-native-share', () => ({
  default: jest.fn(),
}));

jest.mock('react-native-blob-util', () => {
  return {DocumentDir: () => {}, polyfill: () => {}};
});

jest.mock('@react-native-async-storage/async-storage', () =>
  require('@react-native-async-storage/async-storage/jest/async-storage-mock'),
);

jest.mock('react-native-permissions', () => {
  return mock;
});

jest.mock('react-native-view-shot', () => {
  return {
    capture: jest.fn(),
  };
});

jest.mock('react-native/Libraries/Blob/NativeFileReaderModule', () => ({
  readAsText: jest.fn(),
  readAsArrayBuffer: jest.fn(),
}));

jest.mock('@segment/analytics-react-native-plugin-advertising-id', () => ({
  getAdvertisingId: jest.fn().mockResolvedValue('mock-advertising-id'),
  getAdvertisingTrackingEnabled: jest.fn().mockResolvedValue(true),
}));

jest.mock('@segment/analytics-react-native-plugin-idfa', () => ({
  getTrackingAuthorizationStatus: jest.fn().mockResolvedValue('authorized'),
}));

jest.mock('@squantumengine/react-native-sqeid', () => ({
  default: jest.fn(),
}));

jest.mock('@segment/analytics-react-native');

jest.mock('@react-native-firebase/messaging', () => {
  return {
    onMessage: jest.fn(),
    requestPermission: jest.fn(() => Promise.resolve()),
  };
});

jest.mock('@react-native-firebase/remote-config', () => {
  return {
    messaging: jest.fn(),
  };
});

jest.mock('@react-native-firebase/analytics', () => {
  return {
    messaging: jest.fn(),
  };
});

jest.mock('react-native-moengage', () => {
  return {
    messaging: jest.fn(),
  };
});

jest.mock('@react-native-firebase/dynamic-links', () => {
  return {
    messaging: jest.fn(),
  };
});

jest.mock('react-native-gesture-handler', () => {
  return {};
});

jest.mock('@segment/analytics-react-native', () => {
  return {};
});

// jest.mock('@react-native-firebase', () => ({
//   messaging: jest.fn(() => ({
//     hasPermission: jest.fn(() => Promise.resolve(true)),
//     subscribeToTopic: jest.fn(),
//     unsubscribeFromTopic: jest.fn(),
//     requestPermission: jest.fn(() => Promise.resolve(true)),
//     getToken: jest.fn(() => Promise.resolve('myMockToken')),
//   })),
//   notifications: jest.fn(() => ({
//     onNotification: jest.fn(),
//     onNotificationDisplayed: jest.fn(),
//   })),
//   analytics: jest.fn(() => ({
//     logEvent: jest.fn(),
//   })),
// }));
Editor is loading...
Leave a Comment