diff --git a/app/components/Nav/App/index.js b/app/components/Nav/App/index.js index 054ded51d00..1b79af4b2b7 100644 --- a/app/components/Nav/App/index.js +++ b/app/components/Nav/App/index.js @@ -124,7 +124,6 @@ import NftOptions from '../../../components/Views/NftOptions'; import ShowTokenIdSheet from '../../../components/Views/ShowTokenIdSheet'; import OriginSpamModal from '../../Views/OriginSpamModal/OriginSpamModal'; import { isNetworkUiRedesignEnabled } from '../../../util/networks/isNetworkUiRedesignEnabled'; -import ChangeInSimulationModal from '../../Views/ChangeInSimulationModal/ChangeInSimulationModal'; import TooltipModal from '../../../components/Views/TooltipModal'; ///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps) import { SnapsExecutionWebView } from '../../../lib/snaps'; diff --git a/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx b/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx deleted file mode 100644 index abced2cc0c7..00000000000 --- a/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.test.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react'; -import { fireEvent } from '@testing-library/react-native'; - -import renderWithProvider, { - DeepPartial, -} from '../../../util/test/renderWithProvider'; -import { backgroundState } from '../../../util/test/initial-root-state'; -import ChangeInSimulationModal, { - PROCEED_BUTTON_TEST_ID, - REJECT_BUTTON_TEST_ID, -} from './ChangeInSimulationModal'; -import { RootState } from '../../../reducers'; - -jest.mock('react-redux', () => ({ - ...jest.requireActual('react-redux'), - useDispatch: () => jest.fn(), -})); - -jest.mock( - '../../../component-library/components/BottomSheets/BottomSheet', - () => - ({ children }: { children: React.ReactElement }) => - <>{children}, -); - -const NAVIGATION_PARAMS_MOCK = { - params: { - onProceed: jest.fn(), - onReject: jest.fn(), - }, -}; - -const mockInitialState: DeepPartial = { - engine: { - backgroundState: { - ...backgroundState, - }, - }, -}; - -describe('ChangeInSimulationModal', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); - - it('render matches snapshot', () => { - const { toJSON } = renderWithProvider( - , - { - state: mockInitialState, - }, - ); - expect(toJSON()).toMatchSnapshot(); - }); - - it('calls onProceed and onReject callbacks', () => { - const mockOnReject = jest.fn(); - const mockOnProceed = jest.fn(); - const wrapper = renderWithProvider( - , - { - state: mockInitialState, - }, - ); - fireEvent.press(wrapper.getByTestId(PROCEED_BUTTON_TEST_ID)); - expect(mockOnProceed).toHaveBeenCalledTimes(1); - - fireEvent.press(wrapper.getByTestId(REJECT_BUTTON_TEST_ID)); - expect(mockOnReject).toHaveBeenCalledTimes(1); - }); -}); diff --git a/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.tsx b/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.tsx deleted file mode 100644 index ccd7d604f47..00000000000 --- a/app/components/Views/ChangeInSimulationModal/ChangeInSimulationModal.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import React, { useCallback, useRef } from 'react'; -import { StyleSheet, View } from 'react-native'; -import { strings } from '../../../../locales/i18n'; -import BottomSheet, { - BottomSheetRef, -} from '../../../component-library/components/BottomSheets/BottomSheet'; -import Button from '../../../component-library/components/Buttons/Button/Button'; -import Icon, { - IconSize, - IconName, - IconColor, -} from '../../../component-library/components/Icons/Icon'; -import { - ButtonSize, - ButtonVariants, - ButtonWidthTypes, -} from '../../../component-library/components/Buttons/Button'; -import SheetHeader from '../../../component-library/components/Sheet/SheetHeader'; -import Text from '../../../component-library/components/Texts/Text'; - -export const PROCEED_BUTTON_TEST_ID = 'proceed-button'; -export const REJECT_BUTTON_TEST_ID = 'reject-button'; - -const createStyles = () => - StyleSheet.create({ - buttonsWrapper: { - alignSelf: 'stretch', - flexDirection: 'column', - gap: 16, - paddingTop: 24, - }, - wrapper: { - alignItems: 'center', - padding: 16, - }, - description: { - textAlign: 'center', - }, - }); - -const ChangeInSimulationModal = ({ - route, -}: { - route: { params: { onProceed: () => void; onReject: () => void } }; -}) => { - const styles = createStyles(); - const sheetRef = useRef(null); - const { onProceed, onReject } = route.params; - - const handleProceed = useCallback(() => { - sheetRef.current?.onCloseBottomSheet(); - onProceed(); - }, [onProceed, sheetRef]); - - const handleReject = useCallback(() => { - sheetRef.current?.onCloseBottomSheet(); - onReject(); - }, [onReject, sheetRef]); - - return ( - - - - - {strings('change_in_simulation_modal.description')} - -