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", () => {
3333
3434 expect ( shouldSerialize ) . toEqual ( false ) ;
3535 } ) ;
36+
37+ it ( "returns false if value is undefined" , ( ) => {
38+ const shouldSerialize = serializer . test ( undefined ) ;
39+
40+ expect ( shouldSerialize ) . toEqual ( false ) ;
41+ } ) ;
3642} ) ;
3743
3844describe ( "Serialization function" , ( ) => {
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ import * as React from "react";
22
33const JSONLDSerializer : jest . SnapshotSerializerPlugin = {
44 test ( val ) {
5- return (
5+ return Boolean (
66 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"
1212 ) ;
1313 } ,
1414
You can’t perform that action at this time.
0 commit comments