@@ -3,14 +3,12 @@ import useOdometerReadingsState from '@pages/iou/request/step/IOURequestStepDist
33import CONST from '@src/CONST' ;
44import type * as OnyxTypes from '@src/types/onyx' ;
55
6+ const mockIsOdometerDraftPendingHydration = jest . fn ( ( ) => false ) ;
7+
68jest . mock ( '@libs/actions/OdometerTransactionUtils' , ( ) => ( {
7- isOdometerDraftPendingHydration : jest . fn ( ( ) => false ) ,
9+ isOdometerDraftPendingHydration : ( ... args : unknown [ ] ) => mockIsOdometerDraftPendingHydration ( ... ( args as Parameters < typeof mockIsOdometerDraftPendingHydration > ) ) ,
810} ) ) ;
911
10- const { isOdometerDraftPendingHydration} = jest . requireMock ( '@libs/actions/OdometerTransactionUtils' ) as {
11- isOdometerDraftPendingHydration : jest . Mock ;
12- } ;
13-
1412type Params = Parameters < typeof useOdometerReadingsState > [ 0 ] ;
1513
1614const buildOdometerTransaction = ( overrides : Partial < OnyxTypes . Transaction [ 'comment' ] > = { } ) : OnyxTypes . Transaction =>
@@ -35,7 +33,7 @@ const baseParams: Params = {
3533
3634describe ( 'useOdometerReadingsState' , ( ) => {
3735 beforeEach ( ( ) => {
38- isOdometerDraftPendingHydration . mockReturnValue ( false ) ;
36+ mockIsOdometerDraftPendingHydration . mockReturnValue ( false ) ;
3937 } ) ;
4038
4139 it ( 'starts with empty form state, then hydrates startReading/endReading from the transaction' , ( ) => {
@@ -65,7 +63,7 @@ describe('useOdometerReadingsState', () => {
6563 } ) ;
6664
6765 it ( 'does not snapshot the baseline while a save-for-later draft is still pending hydration' , ( ) => {
68- isOdometerDraftPendingHydration . mockReturnValue ( true ) ;
66+ mockIsOdometerDraftPendingHydration . mockReturnValue ( true ) ;
6967 const { result} = renderHook ( ( ) =>
7068 useOdometerReadingsState ( {
7169 ...baseParams ,
0 commit comments