File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ describe("Serializer test function", () => {
33
33
34
34
expect ( shouldSerialize ) . toEqual ( false ) ;
35
35
} ) ;
36
+
37
+ it ( "returns false if value is undefined" , ( ) => {
38
+ const shouldSerialize = serializer . test ( undefined ) ;
39
+
40
+ expect ( shouldSerialize ) . toEqual ( false ) ;
41
+ } ) ;
36
42
} ) ;
37
43
38
44
describe ( "Serialization function" , ( ) => {
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ import * as React from "react";
2
2
3
3
const JSONLDSerializer : jest . SnapshotSerializerPlugin = {
4
4
test ( val ) {
5
- return (
5
+ return Boolean (
6
6
val &&
7
- val . $$typeof === Symbol . for ( "react.element" ) &&
8
- val . type === "script" &&
9
- val . props . dangerouslySetInnerHTML &&
10
- val . props . type &&
11
- val . props . type === "application/ld+json"
7
+ val . $$typeof === Symbol . for ( "react.element" ) &&
8
+ val . type === "script" &&
9
+ val . props . dangerouslySetInnerHTML &&
10
+ val . props . type &&
11
+ val . props . type === "application/ld+json"
12
12
) ;
13
13
} ,
14
14
You can’t perform that action at this time.
0 commit comments