Skip to content

Commit 2f028f8

Browse files
committed
test: more testing
1 parent e7af873 commit 2f028f8

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/internal/useMultiListen.spec.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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";
55

66
const result1 = newSymbol("Result 1");
77
const result2 = newSymbol("Result 2");
@@ -27,14 +27,27 @@ beforeEach(() => {
2727
onChange.mockReturnValue(onChangeUnsubscribe);
2828
});
2929

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 });
3632
});
3733

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+
3851
describe("when changing refs", () => {
3952
it("should not resubscribe for equal ref", async () => {
4053
// first ref

0 commit comments

Comments
 (0)