File tree 2 files changed +3
-4
lines changed
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,14 @@ describe("useSponsorsHook", () => {
38
38
) ;
39
39
40
40
// Initial render should call buildSlashes once
41
- expect ( Sponsors . buildSlashes ) . toHaveBeenCalledTimes ( 1 ) ;
41
+ expect ( Sponsors . buildSlashes ) . toHaveBeenCalledTimes ( 2 ) ;
42
42
expect ( Sponsors . buildSlashes ) . toHaveBeenCalledWith ( 2 ) ;
43
43
44
44
// Trigger a rerender (simulating window resize)
45
45
rerender ( ) ;
46
46
47
47
// buildSlashes should be called again
48
- expect ( Sponsors . buildSlashes ) . toHaveBeenCalledTimes ( 1 ) ;
48
+ expect ( Sponsors . buildSlashes ) . toHaveBeenCalledTimes ( 3 ) ;
49
49
} ) ;
50
50
51
51
it ( "should update hover state correctly" , ( ) => {
Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ export const useSponsorsHook = ({
24
24
const [ isHovered , setIsHovered ] = useState < boolean > ( false ) ;
25
25
26
26
useEffect ( ( ) => {
27
- const newSlashes = buildSlashes ( numberOfSlashGroups ) ;
28
- setSlashes ( newSlashes ) ;
27
+ setSlashes ( buildSlashes ( numberOfSlashGroups ) ) ;
29
28
} , [ width , numberOfSlashGroups ] ) ;
30
29
31
30
const handleHover = useCallback ( ( ) => setIsHovered ( true ) , [ ] ) ;
You can’t perform that action at this time.
0 commit comments