@@ -827,6 +827,43 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
827827 it ( 'parses properties string with single quotes into object' , function ( ) {
828828 const record = { properties : "{'key':'value'}" } ;
829829 const result = this . forwarder . fixPropertiesJsonString ( record ) ;
830+
831+ const expectedProperties = { properties : { key : "value" } } ;
832+
833+ assert . deepEqual (
834+ expectedProperties ,
835+ result
836+ ) ;
837+ assert . equal (
838+ 'object' ,
839+ typeof result . properties
840+ )
841+ } ) ;
842+
843+ it ( 'parses object that doesnt have properties' , function ( ) {
844+ const record = { hostname : "server_name" , subObject : { key :"value" } } ;
845+ const result = this . forwarder . fixPropertiesJsonString ( record ) ;
846+
847+ assert . deepEqual (
848+ record ,
849+ result
850+ ) ;
851+ assert . equal (
852+ 'object' ,
853+ typeof result
854+ )
855+ } ) ;
856+
857+ it ( 'parses properties string with nested objects' , function ( ) {
858+ const record = { properties : "{'key':'value','subObj':{ 'subKey' : 'subValue' }}" } ;
859+ const result = this . forwarder . fixPropertiesJsonString ( record ) ;
860+
861+ const expectedProperties = { properties : { key : "value" , subObj : { subKey : "subValue" } } } ;
862+
863+ assert . deepEqual (
864+ expectedProperties ,
865+ result
866+ ) ;
830867 assert . equal (
831868 'object' ,
832869 typeof result . properties
@@ -836,6 +873,11 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
836873 it ( "leaves properties string unchanged when it doesn't match the malformed pattern" , function ( ) {
837874 const record = { properties : 'some plain string without colons' } ;
838875 const result = this . forwarder . fixPropertiesJsonString ( record ) ;
876+
877+ assert . deepEqual (
878+ record ,
879+ result
880+ ) ;
839881 assert . equal (
840882 'string' ,
841883 typeof result . properties
@@ -846,6 +888,11 @@ describe('EventhubLogHandler Fix Properties Json String', function() {
846888 // includes the "':'" marker so the function attempts replacement, but JSON remains invalid
847889 const badRecord = { properties : "Look i know i shouldn't but, i will do this ':' " } ;
848890 const result = this . forwarder . fixPropertiesJsonString ( badRecord ) ;
891+
892+ assert . deepEqual (
893+ badRecord ,
894+ result
895+ ) ;
849896 assert . equal (
850897 'string' ,
851898 typeof result . properties
0 commit comments