@@ -102,7 +102,25 @@ jest.mock('../../../../../selectors/cardController', () => ({
102102} ) ) ;
103103
104104jest . mock ( '../../../Card/hooks/useMoneyAccountCardLinkage' , ( ) => ( {
105+ __esModule : true ,
105106 useMoneyAccountCardLinkage : jest . fn ( ) ,
107+ default : jest . fn ( ( ) => ( {
108+ moneyAccountCardToken : null ,
109+ canLink : false ,
110+ openLinkCardSheet : jest . fn ( ) ,
111+ } ) ) ,
112+ } ) ) ;
113+
114+ jest . mock ( '../../../Earn/hooks/useMusdBalance' , ( ) => ( {
115+ useMusdBalance : jest . fn ( ( ) => ( { tokenBalanceAggregated : '0' } ) ) ,
116+ } ) ) ;
117+
118+ jest . mock ( '../../hooks/useMoneyOnboardingStep' , ( ) => ( {
119+ useMoneyOnboardingStep : jest . fn ( ( ) => ( {
120+ currentStep : 0 ,
121+ incrementStep : jest . fn ( ) ,
122+ } ) ) ,
123+ MONEY_STEPPER_ID : 'money' ,
106124} ) ) ;
107125
108126jest . mock ( '../../../../../reducers/fiatOrders' , ( ) => ( {
@@ -536,13 +554,6 @@ describe('MoneyHomeView', () => {
536554 } ) ;
537555 } ) ;
538556
539- it ( 'renders onboarding card with step 2' , ( ) => {
540- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
541- expect (
542- getByTestId ( MoneyOnboardingCardTestIds . STEP_LABEL ) ,
543- ) . toHaveTextContent ( 'Step 2 of 2' ) ;
544- } ) ;
545-
546557 it ( 'renders the activity list' , ( ) => {
547558 const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
548559 expect ( getByTestId ( MoneyActivityListTestIds . CONTAINER ) ) . toBeOnTheScreen ( ) ;
@@ -573,14 +584,6 @@ describe('MoneyHomeView', () => {
573584 const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
574585 expect ( getByTestId ( MoneyMetaMaskCardTestIds . CONTAINER ) ) . toBeOnTheScreen ( ) ;
575586 } ) ;
576-
577- it ( 'navigates to Card root when onboarding CTA is tapped' , ( ) => {
578- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
579-
580- fireEvent . press ( getByTestId ( MoneyOnboardingCardTestIds . CTA_BUTTON ) ) ;
581-
582- expect ( mockNavigate ) . toHaveBeenCalledWith ( Routes . CARD . ROOT ) ;
583- } ) ;
584587 } ) ;
585588
586589 describe ( 'card-unlinked state (milestone + has cardholder)' , ( ) => {
@@ -600,16 +603,6 @@ describe('MoneyHomeView', () => {
600603 mockGetDetectedGeolocation . mockReturnValue ( 'GB' ) ;
601604 } ) ;
602605
603- it ( 'renders onboarding card with step 2 and link-card variant' , ( ) => {
604- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
605- expect (
606- getByTestId ( MoneyOnboardingCardTestIds . STEP_LABEL ) ,
607- ) . toHaveTextContent ( 'Step 2 of 2' ) ;
608- expect ( getByTestId ( MoneyOnboardingCardTestIds . TITLE ) ) . toHaveTextContent (
609- strings ( 'money.onboarding.link_card_title' ) ,
610- ) ;
611- } ) ;
612-
613606 it ( 'renders MetaMask Card section in link mode' , ( ) => {
614607 const { getByTestId, queryByTestId } = renderWithProvider (
615608 < MoneyHomeView /> ,
@@ -679,22 +672,6 @@ describe('MoneyHomeView', () => {
679672 expect ( getByTestId ( MoneyFooterTestIds . CONTAINER ) ) . toBeOnTheScreen ( ) ;
680673 } ) ;
681674
682- it ( 'delegates to startLinkFlow with the Money home origin when onboarding CTA is tapped' , ( ) => {
683- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
684-
685- fireEvent . press ( getByTestId ( MoneyOnboardingCardTestIds . CTA_BUTTON ) ) ;
686-
687- expect ( mockStartLinkFlow ) . toHaveBeenCalledTimes ( 1 ) ;
688- expect ( mockStartLinkFlow ) . toHaveBeenCalledWith ( {
689- screen : Routes . MONEY . ROOT ,
690- params : { screen : Routes . MONEY . HOME } ,
691- } ) ;
692- expect ( mockNavigate ) . not . toHaveBeenCalledWith ( Routes . CARD . ROOT , {
693- screen : Routes . CARD . HOME ,
694- } ) ;
695- expect ( mockOpenLinkCardSheet ) . not . toHaveBeenCalled ( ) ;
696- } ) ;
697-
698675 it ( 'delegates to startLinkFlow with the Money home origin when MetaMaskCard link button is tapped' , ( ) => {
699676 const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
700677
@@ -728,24 +705,6 @@ describe('MoneyHomeView', () => {
728705 } as unknown as ReturnType < typeof useMoneyAccountCardLinkage > ) ;
729706 } ) ;
730707
731- it ( 'still calls startLinkFlow (not openLinkCardSheet directly) when onboarding CTA is tapped' , async ( ) => {
732- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
733-
734- await act ( async ( ) => {
735- fireEvent . press ( getByTestId ( MoneyOnboardingCardTestIds . CTA_BUTTON ) ) ;
736- } ) ;
737-
738- expect ( mockStartLinkFlow ) . toHaveBeenCalledTimes ( 1 ) ;
739- expect ( mockStartLinkFlow ) . toHaveBeenCalledWith ( {
740- screen : Routes . MONEY . ROOT ,
741- params : { screen : Routes . MONEY . HOME } ,
742- } ) ;
743- expect ( mockOpenLinkCardSheet ) . not . toHaveBeenCalled ( ) ;
744- expect ( mockNavigate ) . not . toHaveBeenCalledWith ( Routes . CARD . ROOT , {
745- screen : Routes . CARD . HOME ,
746- } ) ;
747- } ) ;
748-
749708 it ( 'still calls startLinkFlow (not openLinkCardSheet directly) when MetaMaskCard link button is tapped' , async ( ) => {
750709 const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
751710
@@ -758,7 +717,6 @@ describe('MoneyHomeView', () => {
758717 screen : Routes . MONEY . ROOT ,
759718 params : { screen : Routes . MONEY . HOME } ,
760719 } ) ;
761- expect ( mockOpenLinkCardSheet ) . not . toHaveBeenCalled ( ) ;
762720 expect ( mockNavigate ) . not . toHaveBeenCalledWith ( Routes . CARD . ROOT , {
763721 screen : Routes . CARD . HOME ,
764722 } ) ;
@@ -777,13 +735,6 @@ describe('MoneyHomeView', () => {
777735 } ) ;
778736 } ) ;
779737
780- it ( 'renders onboarding card with step 1' , ( ) => {
781- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
782- expect (
783- getByTestId ( MoneyOnboardingCardTestIds . STEP_LABEL ) ,
784- ) . toHaveTextContent ( 'Step 1 of 2' ) ;
785- } ) ;
786-
787738 it ( 'does not render the activity list' , ( ) => {
788739 const { queryByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
789740 expect (
@@ -808,18 +759,18 @@ describe('MoneyHomeView', () => {
808759 expect ( getByTestId ( MoneyWhatYouGetTestIds . CONTAINER ) ) . toBeOnTheScreen ( ) ;
809760 } ) ;
810761
811- it . each ( [
812- [ 'onboarding card CTA' , MoneyOnboardingCardTestIds . CTA_BUTTON ] ,
813- [ 'mUSD row Add' , MoneyMusdTokenRowTestIds . ADD_BUTTON ] ,
814- ] ) ( 'opens the Add money sheet from the %s button' , ( _label , testId ) => {
815- const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
762+ it . each ( [ [ 'mUSD row Add' , MoneyMusdTokenRowTestIds . ADD_BUTTON ] ] ) (
763+ 'opens the Add money sheet from the %s button' ,
764+ ( _label , testId ) => {
765+ const { getByTestId } = renderWithProvider ( < MoneyHomeView /> ) ;
816766
817- fireEvent . press ( getByTestId ( testId ) ) ;
767+ fireEvent . press ( getByTestId ( testId ) ) ;
818768
819- expect ( mockNavigate ) . toHaveBeenCalledWith ( Routes . MONEY . MODALS . ROOT , {
820- screen : Routes . MONEY . MODALS . ADD_MONEY_SHEET ,
821- } ) ;
822- } ) ;
769+ expect ( mockNavigate ) . toHaveBeenCalledWith ( Routes . MONEY . MODALS . ROOT , {
770+ screen : Routes . MONEY . MODALS . ADD_MONEY_SHEET ,
771+ } ) ;
772+ } ,
773+ ) ;
823774
824775 it ( 'navigates to Asset details when the mUSD token row is pressed' , ( ) => {
825776 const NavigationService = jest . requireMock (
0 commit comments