Skip to content

Commit

Permalink
fixed: AppState mock
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-8 committed Nov 21, 2024
1 parent fedc12f commit d0d238e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
37 changes: 19 additions & 18 deletions jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
/* global jest */

import NavigationHolder from './src/NavigationHolder'
import NavigationHolder from './src/NavigationHolder';

jest.mock('react-native/Libraries/AppState/AppState', () => ({
currentState: 'active',
}));

jest.mock('react-native-localize', () => ({
findBestLanguageTag: () => ({ languageTag: 'en' }),
}));

jest.mock('react-native-blob-util', () => ({
fetch: () => {},
wrap: () => {}
wrap: () => {},
}));

jest.mock('expo-file-system', () => ({
createUploadTask: jest.fn(),
FileSystemUploadType: {
MULTIPART: 1
MULTIPART: 1,
},
FileSystemSessionType: {
BACKGROUND: 0
}
BACKGROUND: 0,
},
}));

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

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

jest.mock('countly-sdk-react-native-bridge', () => ({
enableParameterTamperingProtection: () => {},
Expand All @@ -46,22 +49,20 @@ jest.mock('react-native-background-geolocation', () => ({
stop: jest.fn(),
removeListeners: jest.fn(),
changePace: jest.fn(),
}))
}));

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

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

jest.mock('uuid', () => ({
v4: jest.fn(),
}))
}));

const fakeNavigator = {
current: {
dispatch: (action) => {}
}
}
dispatch: action => {},
},
};

NavigationHolder.setNavigationRef(fakeNavigator)
NavigationHolder.setNavigationRef(fakeNavigator);
6 changes: 0 additions & 6 deletions src/redux/Restaurant/__tests__/middlewares.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import { notifyOnNewOrderCreated } from '../middlewares';
import restaurantReducer from '../reducers';

describe('notifyOnNewOrderCreated', () => {
beforeEach(() => {
jest.mock('react-native/Libraries/AppState/AppState', () => ({
currentState: 'active',
}));
});

it('does nothing with action type "LOAD_ORDERS_SUCCESS"', () => {
const preloadedState = {
app: {
Expand Down

0 comments on commit d0d238e

Please sign in to comment.