mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
Update react-native to 0.79 (#3051)
* Upgrade helper: package.json
* Upgrade helper: gems
* Upgrade helper: Android
* Update AppDelegate
* Fix error in compiling
* Update package-lock.json
* Update Podfile.lock
* Update package-lock.json
* Update Podfile.lock
* Remove no longer needed mock
* Comment out entire test and not only the expect call
* Most other unit tests use this render helper function that
wraps the component in the entire app.
* Mock react-native exports as esModule
* Update .flowconfig
* Update Gemfile
* Revert "Comment out entire test and not only the expect call"
This reverts commit 8785f81529.
This commit is contained in:
@@ -82,10 +82,13 @@ const mockModelResultWithHuman = {
|
||||
]
|
||||
};
|
||||
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
OS: "ios",
|
||||
select: jest.fn( ),
|
||||
Version: 11
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", () => ( {
|
||||
__esModule: true,
|
||||
default: {
|
||||
OS: "ios",
|
||||
select: jest.fn(),
|
||||
Version: 11
|
||||
}
|
||||
} ) );
|
||||
|
||||
const mockFetchUserLocation = jest.fn( () => ( { latitude: 56, longitude: 9, accuracy: 8 } ) );
|
||||
|
||||
@@ -39,10 +39,13 @@ afterEach( () => {
|
||||
Animated.Value = OriginalValue;
|
||||
} );
|
||||
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
OS: "ios",
|
||||
select: jest.fn( ),
|
||||
Version: 11
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", () => ( {
|
||||
__esModule: true,
|
||||
default: {
|
||||
OS: "ios",
|
||||
select: jest.fn(),
|
||||
Version: 11
|
||||
}
|
||||
} ) );
|
||||
|
||||
const mockLocalTaxon = {
|
||||
|
||||
@@ -38,10 +38,13 @@ afterEach( () => {
|
||||
Animated.Value = OriginalValue;
|
||||
} );
|
||||
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
OS: "ios",
|
||||
select: jest.fn( ),
|
||||
Version: 11
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", () => ( {
|
||||
__esModule: true,
|
||||
default: {
|
||||
OS: "ios",
|
||||
select: jest.fn(),
|
||||
Version: 11
|
||||
}
|
||||
} ) );
|
||||
|
||||
const mockFetchUserLocation = jest.fn( () => ( { latitude: 56, longitude: 9, accuracy: 8 } ) );
|
||||
|
||||
@@ -27,9 +27,12 @@ afterAll( uniqueRealmAfterAll );
|
||||
// /UNIQUE REALM SETUP
|
||||
|
||||
jest.mock( "react-native/Libraries/AppState/AppState", () => ( {
|
||||
addEventListener: jest.fn( ( event, callback ) => {
|
||||
callback( "active" );
|
||||
} )
|
||||
__esModule: true,
|
||||
default: {
|
||||
addEventListener: jest.fn( ( event, callback ) => {
|
||||
callback( "active" );
|
||||
} )
|
||||
}
|
||||
} ) );
|
||||
|
||||
const mockObservations = [
|
||||
|
||||
@@ -10,7 +10,6 @@ import mockBottomSheet from "@gorhom/bottom-sheet/mock";
|
||||
import mockRNCNetInfo from "@react-native-community/netinfo/jest/netinfo-mock";
|
||||
import inatjs from "inaturalistjs";
|
||||
import fetchMock from "jest-fetch-mock";
|
||||
import mockBackHandler from "react-native/Libraries/Utilities/__mocks__/BackHandler";
|
||||
import mockRNDeviceInfo from "react-native-device-info/jest/react-native-device-info-mock";
|
||||
import mockSafeAreaContext from "react-native-safe-area-context/jest/mock";
|
||||
|
||||
@@ -55,10 +54,6 @@ jest.mock( "@gorhom/bottom-sheet", () => ( {
|
||||
jest.mock( "@react-native-community/netinfo", () => mockRNCNetInfo );
|
||||
jest.mock( "react-native-device-info", () => mockRNDeviceInfo );
|
||||
jest.mock( "react-native-safe-area-context", () => mockSafeAreaContext );
|
||||
jest.mock(
|
||||
"react-native/Libraries/Utilities/BackHandler",
|
||||
() => mockBackHandler
|
||||
);
|
||||
|
||||
require( "react-native-reanimated" ).setUpTests();
|
||||
|
||||
|
||||
@@ -5,9 +5,12 @@ import React from "react";
|
||||
|
||||
// Make sure the mock is using a recent-ish version
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
OS: "ios",
|
||||
select: jest.fn( ),
|
||||
Version: 11
|
||||
__esModule: true,
|
||||
default: {
|
||||
OS: "ios",
|
||||
select: jest.fn( ),
|
||||
Version: 11
|
||||
}
|
||||
} ) );
|
||||
|
||||
describe( "AddObsModal", ( ) => {
|
||||
|
||||
@@ -7,10 +7,13 @@ import i18next from "i18next";
|
||||
import React from "react";
|
||||
|
||||
// Make sure the mock reports OS version 9
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
OS: "ios",
|
||||
select: jest.fn( ),
|
||||
Version: 9
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", () => ( {
|
||||
__esModule: true,
|
||||
default: {
|
||||
OS: "ios",
|
||||
select: jest.fn(),
|
||||
Version: 9
|
||||
}
|
||||
} ) );
|
||||
|
||||
describe( "AddObsModal in iOS 9", ( ) => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {
|
||||
fireEvent, render, screen, waitFor
|
||||
fireEvent, screen, waitFor
|
||||
} from "@testing-library/react-native";
|
||||
import StandardCamera from "components/Camera/StandardCamera/StandardCamera";
|
||||
import React from "react";
|
||||
import useStore from "stores/useStore";
|
||||
import factory from "tests/factory";
|
||||
import { wrapInNavigationContainer } from "tests/helpers/render";
|
||||
import { renderComponent } from "tests/helpers/render";
|
||||
|
||||
jest.mock( "components/MediaViewer/MediaViewerModal", ( ) => jest.fn( ( ) => null ) );
|
||||
|
||||
@@ -37,15 +37,13 @@ const mockObservation = factory( "RemoteObservation", {
|
||||
]
|
||||
} );
|
||||
|
||||
const renderCamera = ( ) => render(
|
||||
wrapInNavigationContainer(
|
||||
<StandardCamera
|
||||
camera={{}}
|
||||
device={{}}
|
||||
setNewPhotoUris={jest.fn( )}
|
||||
newPhotoUris={[]}
|
||||
/>
|
||||
)
|
||||
const renderCamera = ( ) => renderComponent(
|
||||
<StandardCamera
|
||||
camera={{}}
|
||||
device={{}}
|
||||
setNewPhotoUris={jest.fn( )}
|
||||
newPhotoUris={[]}
|
||||
/>
|
||||
);
|
||||
|
||||
beforeAll( async () => {
|
||||
|
||||
@@ -6,12 +6,18 @@ import { Platform, Share } from "react-native";
|
||||
import { renderComponent } from "tests/helpers/render";
|
||||
|
||||
jest.mock( "react-native/Libraries/Share/Share", () => ( {
|
||||
share: jest.fn( () => Promise.resolve( "mockResolve" ) )
|
||||
__esModule: true,
|
||||
default: {
|
||||
share: jest.fn( () => Promise.resolve( "mockResolve" ) )
|
||||
}
|
||||
} ) );
|
||||
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", ( ) => ( {
|
||||
OS: "ios",
|
||||
select: jest.fn( )
|
||||
jest.mock( "react-native/Libraries/Utilities/Platform", () => ( {
|
||||
__esModule: true,
|
||||
default: {
|
||||
OS: "ios",
|
||||
select: jest.fn()
|
||||
}
|
||||
} ) );
|
||||
|
||||
const observationId = 1234;
|
||||
|
||||
Reference in New Issue
Block a user