@@ -28,6 +28,7 @@ import {
2828} from '@src/libs/CardUtils' ;
2929import type { CardFeeds , CardList , CompanyCardFeed , ExpensifyCardSettings , PersonalDetailsList , Policy , WorkspaceCardsList } from '@src/types/onyx' ;
3030import type { CompanyCardFeedWithNumber } from '@src/types/onyx/CardFeeds' ;
31+ import { localeCompare } from '../utils/TestHelper' ;
3132import waitForBatchedUpdates from '../utils/waitForBatchedUpdates' ;
3233
3334const shortDate = '0924' ;
@@ -931,7 +932,7 @@ describe('CardUtils', () => {
931932 it ( 'should sort cards by cardholder name in ascending order' , ( ) => {
932933 const policyMembersAccountIDs = [ 1 , 2 , 3 ] ;
933934 const cards = getCardsByCardholderName ( mockCards , policyMembersAccountIDs ) ;
934- const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails ) ;
935+ const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails , localeCompare ) ;
935936
936937 expect ( sortedCards ) . toHaveLength ( 3 ) ;
937938 expect ( sortedCards . at ( 0 ) ?. cardID ) . toBe ( 2 ) ;
@@ -942,7 +943,7 @@ describe('CardUtils', () => {
942943 it ( 'should filter out cards that are not associated with policy members' , ( ) => {
943944 const policyMembersAccountIDs = [ 1 , 2 ] ; // Exclude accountID 3
944945 const cards = getCardsByCardholderName ( mockCards , policyMembersAccountIDs ) ;
945- const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails ) ;
946+ const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails , localeCompare ) ;
946947
947948 expect ( sortedCards ) . toHaveLength ( 2 ) ;
948949 expect ( sortedCards . at ( 0 ) ?. cardID ) . toBe ( 2 ) ;
@@ -952,15 +953,15 @@ describe('CardUtils', () => {
952953 it ( 'should handle undefined cardsList' , ( ) => {
953954 const policyMembersAccountIDs = [ 1 , 2 , 3 ] ;
954955 const cards = getCardsByCardholderName ( undefined , policyMembersAccountIDs ) ;
955- const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails ) ;
956+ const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails , localeCompare ) ;
956957
957958 expect ( sortedCards ) . toHaveLength ( 0 ) ;
958959 } ) ;
959960
960961 it ( 'should handle undefined personalDetails' , ( ) => {
961962 const policyMembersAccountIDs = [ 1 , 2 , 3 ] ;
962963 const cards = getCardsByCardholderName ( mockCards , policyMembersAccountIDs ) ;
963- const sortedCards = sortCardsByCardholderName ( cards , undefined ) ;
964+ const sortedCards = sortCardsByCardholderName ( cards , undefined , localeCompare ) ;
964965
965966 expect ( sortedCards ) . toHaveLength ( 3 ) ;
966967 // All cards should be sorted with default names
@@ -998,7 +999,7 @@ describe('CardUtils', () => {
998999
9991000 const policyMembersAccountIDs = [ 1 , 2 ] ;
10001001 const cards = getCardsByCardholderName ( cardsWithMissingAccountID , policyMembersAccountIDs ) ;
1001- const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails ) ;
1002+ const sortedCards = sortCardsByCardholderName ( cards , mockPersonalDetails , localeCompare ) ;
10021003
10031004 expect ( sortedCards ) . toHaveLength ( 1 ) ;
10041005 expect ( sortedCards . at ( 0 ) ?. cardID ) . toBe ( 1 ) ;
0 commit comments