File tree Expand file tree Collapse file tree 2 files changed +52
-1
lines changed
src/pages/settings/Wallet/ExpensifyCardPage Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ function ExpensifyCardPage({route}: ExpensifyCardPageProps) {
143143
144144 const hasDetectedDomainFraud = cardsToShow ?. some ( ( card ) => card ?. fraud === CONST . EXPENSIFY_CARD . FRAUD_TYPES . DOMAIN ) ;
145145 const hasDetectedIndividualFraud = cardsToShow ?. some ( ( card ) => card ?. fraud === CONST . EXPENSIFY_CARD . FRAUD_TYPES . INDIVIDUAL ) ;
146- const currentPhysicalCard = physicalCards ?. find ( ( card ) => String ( card ?. cardID ) === cardID ) ;
146+ const currentPhysicalCard = useMemo (
147+ ( ) => physicalCards ?. find ( ( card ) => String ( card ?. cardID ) === cardID ) ?? physicalCards ?. at ( 0 ) ,
148+ [ physicalCards , cardID ] ,
149+ ) ;
147150
148151 // Cards that are already activated and working (OPEN) and cards shipped but not activated yet can be reported as missing or damaged
149152 const shouldShowReportLostCardButton = currentPhysicalCard ?. state === CONST . EXPENSIFY_CARD . STATE . NOT_ACTIVATED || currentPhysicalCard ?. state === CONST . EXPENSIFY_CARD . STATE . OPEN ;
Original file line number Diff line number Diff line change @@ -240,4 +240,52 @@ describe('ExpensifyCardPage', () => {
240240 unmount ( ) ;
241241 await waitForBatchedUpdatesWithAct ( ) ;
242242 } ) ;
243+
244+ it ( 'should still show physical card details when opening a combo card page via the virtual card ID' , async ( ) => {
245+ await TestHelper . signInWithTestUser ( ) ;
246+
247+ await act ( async ( ) => {
248+ await Onyx . merge ( ONYXKEYS . CARD_LIST , {
249+ 1234 : {
250+ cardID : 1234 ,
251+ state : CONST . EXPENSIFY_CARD . STATE . OPEN ,
252+ domainName : 'combo-domain' ,
253+ fundID : '12345' ,
254+ nameValuePairs : {
255+ isVirtual : false ,
256+ cardTitle : 'Combo Physical Card' ,
257+ feedCountry : CONST . COUNTRY . GB ,
258+ } ,
259+ availableSpend : 50000 ,
260+ fraud : null ,
261+ lastFourPAN : '1234' ,
262+ } ,
263+ 5678 : {
264+ cardID : 5678 ,
265+ state : CONST . EXPENSIFY_CARD . STATE . OPEN ,
266+ domainName : 'combo-domain' ,
267+ fundID : '12345' ,
268+ nameValuePairs : {
269+ isVirtual : true ,
270+ cardTitle : 'Combo Virtual Card' ,
271+ } ,
272+ availableSpend : 50000 ,
273+ fraud : null ,
274+ lastFourPAN : '5678' ,
275+ } ,
276+ } ) ;
277+ } ) ;
278+
279+ const { unmount} = renderPage ( SCREENS . SETTINGS . WALLET . DOMAIN_CARD , { cardID : '5678' } ) ;
280+
281+ await waitForBatchedUpdatesWithAct ( ) ;
282+
283+ await waitFor ( ( ) => {
284+ expect ( screen . getByText ( TestHelper . translateLocal ( 'cardPage.virtualCardNumber' ) ) ) . toBeOnTheScreen ( ) ;
285+ expect ( screen . getByText ( TestHelper . translateLocal ( 'cardPage.physicalCardNumber' ) ) ) . toBeOnTheScreen ( ) ;
286+ } ) ;
287+
288+ unmount ( ) ;
289+ await waitForBatchedUpdatesWithAct ( ) ;
290+ } ) ;
243291} ) ;
You can’t perform that action at this time.
0 commit comments