File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 22
33import * as React from "react" ;
44
5- function isReactElement ( val : any ) : boolean {
6- return Boolean ( val . $$typeof && val . $$typeof === Symbol . for ( "react.element" ) ) ;
7- }
8-
9- function isScriptElement ( val : any ) : boolean {
10- return Boolean ( val . type && val . type === "script" ) ;
11- }
12-
135function hasValidProps ( val : any ) : boolean {
146 return Boolean (
15- val . props &&
16- val . props . dangerouslySetInnerHTML &&
7+ val . props . dangerouslySetInnerHTML &&
178 val . props . type &&
189 val . props . type === "application/ld+json"
1910 ) ;
@@ -22,7 +13,10 @@ function hasValidProps(val: any): boolean {
2213const JSONLDSerializer : jest . SnapshotSerializerPlugin = {
2314 test ( val ) {
2415 return Boolean (
25- val && isReactElement ( val ) && isScriptElement ( val ) && hasValidProps ( val )
16+ val &&
17+ React . isValidElement ( val ) &&
18+ val . type === "script" &&
19+ hasValidProps ( val )
2620 ) ;
2721 } ,
2822
You can’t perform that action at this time.
0 commit comments