@@ -27,10 +27,26 @@ const mockedUseResponsiveLayout = useResponsiveLayout as jest.MockedFunction<typ
2727// Mock useIsHomeRouteActive to avoid navigation state issues
2828jest . mock ( '@navigation/helpers/useIsHomeRouteActive' , ( ) => ( ) : boolean => false ) ;
2929
30+ let mockUseAnimatedStyleUpdater : ( ) => Record < string , unknown > ;
3031// Silence react-native-reanimated warnings in Jest
3132jest . mock ( 'react-native-reanimated' , ( ) => {
3233 // eslint-disable-next-line @typescript-eslint/no-unsafe-return
33- return require ( 'react-native-reanimated/mock' ) ;
34+ return {
35+ ...require ( 'react-native-reanimated/mock' ) ,
36+ interpolateColor : ( value : number , input : number [ ] , output : string [ ] ) => {
37+ const [ , inputMax ] = input ;
38+ const [ colorMin , colorMax ] = output ;
39+
40+ if ( value >= inputMax ) {
41+ return colorMax ;
42+ }
43+ return colorMin ;
44+ } ,
45+ useAnimatedStyle : ( updater : ( ) => Record < string , unknown > ) => {
46+ mockUseAnimatedStyleUpdater = updater ;
47+ return updater ( ) ;
48+ } ,
49+ } ;
3450} ) ;
3551
3652describe ( 'FloatingActionButton hover' , ( ) => {
@@ -67,13 +83,15 @@ describe('FloatingActionButton hover', () => {
6783 // Before hover, should not have successHover background
6884 expect ( animatedContainer ) . not . toHaveStyle ( { backgroundColor : colors . productDark500 } ) ;
6985
86+ expect ( mockUseAnimatedStyleUpdater ( ) ) . not . toEqual ( expect . objectContaining ( { backgroundColor : colors . productDark500 } ) ) ;
87+
7088 // Test hover in
7189 fireEvent ( fab , 'hoverIn' ) ;
72- expect ( animatedContainer ) . toHaveStyle ( { backgroundColor : colors . productDark500 } ) ;
90+ expect ( mockUseAnimatedStyleUpdater ( ) ) . toEqual ( expect . objectContaining ( { backgroundColor : colors . productDark500 } ) ) ;
7391
7492 // Test hover out
7593 fireEvent ( fab , 'hoverOut' ) ;
76- expect ( animatedContainer ) . not . toHaveStyle ( { backgroundColor : colors . productDark500 } ) ;
94+ expect ( mockUseAnimatedStyleUpdater ( ) ) . not . toEqual ( expect . objectContaining ( { backgroundColor : colors . productDark500 } ) ) ;
7795 } ) ;
7896
7997 it ( 'should render animated button if LHB is visible' , ( ) => {
0 commit comments