1
- import { act , renderHook } from "@testing-library/react" ;
2
- import { newSymbol } from "../__testfixtures__/index.js" ;
3
- import { useMultiListen } from "./useMultiListen.js" ;
4
- import { it , expect , beforeEach , describe , vi } from "vitest" ;
1
+ import { act , configure , renderHook } from "@testing-library/react" ;
2
+ import { newSymbol } from "../__testfixtures__/index.js/index.js " ;
3
+ import { useMultiListen } from "./useMultiListen.js.js " ;
4
+ import { it , expect , beforeEach , describe , vi , afterEach } from "vitest" ;
5
5
6
6
const result1 = newSymbol ( "Result 1" ) ;
7
7
const result2 = newSymbol ( "Result 2" ) ;
@@ -27,14 +27,27 @@ beforeEach(() => {
27
27
onChange . mockReturnValue ( onChangeUnsubscribe ) ;
28
28
} ) ;
29
29
30
- it ( "initial state" , ( ) => {
31
- const { result } = renderHook ( ( ) => useMultiListen ( [ refA1 , refB1 ] , onChange , isEqual ) ) ;
32
- expect ( result . current ) . toStrictEqual ( [
33
- [ undefined , true , undefined ] ,
34
- [ undefined , true , undefined ] ,
35
- ] ) ;
30
+ afterEach ( ( ) => {
31
+ configure ( { reactStrictMode : false } ) ;
36
32
} ) ;
37
33
34
+ describe . each ( [ { reactStrictMode : true } , { reactStrictMode : false } ] ) (
35
+ `strictMode=$reactStrictMode` ,
36
+ ( { reactStrictMode } ) => {
37
+ beforeEach ( ( ) => {
38
+ configure ( { reactStrictMode } ) ;
39
+ } ) ;
40
+
41
+ it ( "initial state" , ( ) => {
42
+ const { result } = renderHook ( ( ) => useMultiListen ( [ refA1 , refB1 ] , onChange , isEqual ) ) ;
43
+ expect ( result . current ) . toStrictEqual ( [
44
+ [ undefined , true , undefined ] ,
45
+ [ undefined , true , undefined ] ,
46
+ ] ) ;
47
+ } ) ;
48
+ } ,
49
+ ) ;
50
+
38
51
describe ( "when changing refs" , ( ) => {
39
52
it ( "should not resubscribe for equal ref" , async ( ) => {
40
53
// first ref
0 commit comments