@@ -26,7 +26,7 @@ import type {
2626} from '../../src/index'
2727import type { FunctionComponent , DispatchWithoutAction , ReactNode } from 'react'
2828import type { Store , AnyAction } from 'redux'
29- import { StabilityCheck , UseSelectorOptions } from '../../src/hooks/useSelector'
29+ import { UseSelectorOptions } from '../../src/hooks/useSelector'
3030
3131// most of these tests depend on selectors being run once, which stabilityCheck doesn't do
3232// rather than specify it every time, let's make a new "default" here
@@ -757,8 +757,8 @@ describe('React', () => {
757757 selector,
758758 options,
759759 } : {
760- selector : ( state : NormalStateType ) => number
761- options ?: UseSelectorOptions < number >
760+ selector : ( state : NormalStateType ) => unknown
761+ options ?: UseSelectorOptions < unknown >
762762 } ) => {
763763 useSelector ( selector , options )
764764 return null
@@ -800,6 +800,23 @@ describe('React', () => {
800800 } )
801801 )
802802 } )
803+ it ( 'uses provided equalityFn' , ( ) => {
804+ const unstableSelector = jest . fn ( ( state : NormalStateType ) => ( {
805+ count : state . count ,
806+ } ) )
807+
808+ rtl . render (
809+ < Provider store = { normalStore } >
810+ < RenderSelector
811+ selector = { unstableSelector }
812+ options = { { equalityFn : shallowEqual } }
813+ />
814+ </ Provider >
815+ )
816+
817+ expect ( unstableSelector ) . toHaveBeenCalledTimes ( 2 )
818+ expect ( consoleSpy ) . not . toHaveBeenCalled ( )
819+ } )
803820 it ( 'by default will only check on first selector call' , ( ) => {
804821 rtl . render (
805822 < Provider store = { normalStore } >
0 commit comments