File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 1- import { createValueElement } from "react-default-memo" ;
1+ import { createValueElement } from "../src" ;
2+ import { shallow } from "tuplerone" ;
23
34describe ( "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} ) ;
You can’t perform that action at this time.
0 commit comments