Skip to content

Commit bdfc694

Browse files
committed
fix: test
1 parent 585f3b1 commit bdfc694

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/index.test.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
import { createValueElement } from "react-default-memo";
1+
import { createValueElement } from "../src";
2+
import { shallow } from "tuplerone";
23

34
describe("createValueElement", () => {
4-
it("works", () => {
5-
const el1 = createValueElement("div", { a: { b: 1 } });
6-
const el2 = createValueElement("div", { a: { b: 1 } });
5+
it("works with props", () => {
6+
const c = () => null;
7+
const el1 = createValueElement(c, { a: { b: 1 } });
8+
const el2 = createValueElement(c, { a: { b: 1 } });
79

8-
expect(el1).toEqual(el2);
10+
expect(el1).toBe(el2);
11+
});
12+
13+
it("handles circular references", () => {
14+
const a = {};
15+
const b = { a };
16+
a.b = b;
17+
expect(() => createValueElement(() => null, a)).toThrow();
18+
const c = { a };
19+
c.a[shallow] = true;
20+
expect(() => createValueElement(() => null, c)).not.toThrow();
921
});
1022
});

0 commit comments

Comments
 (0)