@@ -12,7 +12,7 @@ import {
1212 hasTravelInvoicingSettlementAccount ,
1313 isTravelCVVEligible ,
1414} from '@src/libs/TravelInvoicingUtils' ;
15- import type { BankAccountList , WorkspaceCardsList } from '@src/types/onyx' ;
15+ import type { BankAccountList , CardList } from '@src/types/onyx' ;
1616import type { ExpensifyCardSettingsBase } from '@src/types/onyx/ExpensifyCardSettings' ;
1717
1818jest . mock ( '@src/libs/Environment/Environment' , ( ) => ( {
@@ -242,64 +242,58 @@ describe('TravelInvoicingUtils', () => {
242242
243243 it ( 'Should return undefined when no travel card exists' , ( ) => {
244244 const cardList = {
245- workspaceCards : {
246- // eslint-disable-next-line @typescript-eslint/naming-convention
247- '1234' : {
248- cardID : 1234 ,
249- state : 3 ,
250- nameValuePairs : {
251- isVirtual : true ,
252- feedCountry : 'OTHER_COUNTRY' ,
253- } ,
245+ // eslint-disable-next-line @typescript-eslint/naming-convention
246+ '1234' : {
247+ cardID : 1234 ,
248+ state : 3 ,
249+ nameValuePairs : {
250+ isVirtual : true ,
251+ feedCountry : 'OTHER_COUNTRY' ,
254252 } ,
255253 } ,
256- } as unknown as Record < string , WorkspaceCardsList > ;
254+ } as unknown as CardList ;
257255 const result = getTravelInvoicingCard ( cardList ) ;
258256 expect ( result ) . toBeUndefined ( ) ;
259257 } ) ;
260258
261259 it ( 'Should return the travel card when feedCountry is PROGRAM_TRAVEL_US' , ( ) => {
262260 const cardList = {
263- workspaceCards : {
264- // eslint-disable-next-line @typescript-eslint/naming-convention
265- '1234' : {
266- cardID : 1234 ,
267- state : 3 ,
268- nameValuePairs : {
269- isVirtual : true ,
270- feedCountry : CONST . TRAVEL . PROGRAM_TRAVEL_US ,
271- } ,
261+ // eslint-disable-next-line @typescript-eslint/naming-convention
262+ '1234' : {
263+ cardID : 1234 ,
264+ state : 3 ,
265+ nameValuePairs : {
266+ isVirtual : true ,
267+ feedCountry : CONST . TRAVEL . PROGRAM_TRAVEL_US ,
272268 } ,
273269 } ,
274- } as unknown as Record < string , WorkspaceCardsList > ;
270+ } as unknown as CardList ;
275271 const result = getTravelInvoicingCard ( cardList ) ;
276272 expect ( result ) . toBeDefined ( ) ;
277273 expect ( result ?. cardID ) . toBe ( 1234 ) ;
278274 } ) ;
279275
280276 it ( 'Should return first travel card when multiple cards exist' , ( ) => {
281277 const cardList = {
282- workspaceCards : {
283- // eslint-disable-next-line @typescript-eslint/naming-convention
284- '1111' : {
285- cardID : 1111 ,
286- state : 3 ,
287- nameValuePairs : {
288- isVirtual : true ,
289- feedCountry : 'OTHER_COUNTRY' ,
290- } ,
278+ // eslint-disable-next-line @typescript-eslint/naming-convention
279+ '1111' : {
280+ cardID : 1111 ,
281+ state : 3 ,
282+ nameValuePairs : {
283+ isVirtual : true ,
284+ feedCountry : 'OTHER_COUNTRY' ,
291285 } ,
292- // eslint-disable-next-line @typescript-eslint/naming-convention
293- '2222' : {
294- cardID : 2222 ,
295- state : 3 ,
296- nameValuePairs : {
297- isVirtual : true ,
298- feedCountry : CONST . TRAVEL . PROGRAM_TRAVEL_US ,
299- } ,
286+ } ,
287+ // eslint-disable-next-line @typescript-eslint/naming-convention
288+ '2222' : {
289+ cardID : 2222 ,
290+ state : 3 ,
291+ nameValuePairs : {
292+ isVirtual : true ,
293+ feedCountry : CONST . TRAVEL . PROGRAM_TRAVEL_US ,
300294 } ,
301295 } ,
302- } as unknown as Record < string , WorkspaceCardsList > ;
296+ } as unknown as CardList ;
303297 const result = getTravelInvoicingCard ( cardList ) ;
304298 expect ( result ) . toBeDefined ( ) ;
305299 expect ( result ?. nameValuePairs ?. feedCountry ) . toBe ( CONST . TRAVEL . PROGRAM_TRAVEL_US ) ;
@@ -308,19 +302,17 @@ describe('TravelInvoicingUtils', () => {
308302 isDevelopmentSpy . mockReturnValue ( true ) ;
309303
310304 const cardList = {
311- workspaceCards : {
312- // eslint-disable-next-line @typescript-eslint/naming-convention
313- '9999' : {
314- cardID : 9999 ,
315- state : 3 ,
316- bank : 'Expensify Card' ,
317- nameValuePairs : {
318- isVirtual : true ,
319- feedCountry : 'OTHER_COUNTRY' ,
320- } ,
305+ // eslint-disable-next-line @typescript-eslint/naming-convention
306+ '9999' : {
307+ cardID : 9999 ,
308+ state : 3 ,
309+ bank : 'Expensify Card' ,
310+ nameValuePairs : {
311+ isVirtual : true ,
312+ feedCountry : 'OTHER_COUNTRY' ,
321313 } ,
322314 } ,
323- } as unknown as Record < string , WorkspaceCardsList > ;
315+ } as unknown as CardList ;
324316
325317 const result = getTravelInvoicingCard ( cardList ) ;
326318 expect ( result ) . toBeDefined ( ) ;
@@ -330,33 +322,29 @@ describe('TravelInvoicingUtils', () => {
330322
331323 describe ( 'isTravelCVVEligible' , ( ) => {
332324 const mockTravelCardList = {
333- workspaceCards : {
334- // eslint-disable-next-line @typescript-eslint/naming-convention
335- '1234' : {
336- cardID : 1234 ,
337- state : 3 ,
338- nameValuePairs : {
339- isVirtual : true ,
340- feedCountry : CONST . TRAVEL . PROGRAM_TRAVEL_US ,
341- } ,
325+ // eslint-disable-next-line @typescript-eslint/naming-convention
326+ '1234' : {
327+ cardID : 1234 ,
328+ state : 3 ,
329+ nameValuePairs : {
330+ isVirtual : true ,
331+ feedCountry : CONST . TRAVEL . PROGRAM_TRAVEL_US ,
342332 } ,
343333 } ,
344- } as unknown as Record < string , WorkspaceCardsList > ;
334+ } as unknown as CardList ;
345335
346336 const mockNonTravelCardList = {
347- workspaceCards : {
348- // eslint-disable-next-line @typescript-eslint/naming-convention
349- '5678' : {
350- cardID : 5678 ,
351- state : 3 ,
352- bank : 'Expensify Card' ,
353- nameValuePairs : {
354- isVirtual : true ,
355- feedCountry : 'OTHER_COUNTRY' ,
356- } ,
337+ // eslint-disable-next-line @typescript-eslint/naming-convention
338+ '5678' : {
339+ cardID : 5678 ,
340+ state : 3 ,
341+ bank : 'Expensify Card' ,
342+ nameValuePairs : {
343+ isVirtual : true ,
344+ feedCountry : 'OTHER_COUNTRY' ,
357345 } ,
358346 } ,
359- } as unknown as Record < string , WorkspaceCardsList > ;
347+ } as unknown as CardList ;
360348
361349 it ( 'Should return false when beta is false' , ( ) => {
362350 const result = isTravelCVVEligible ( false , mockTravelCardList ) ;
0 commit comments