File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,3 +176,19 @@ describe('trackUser', () => {
176176 expect ( fetchMock ) . not . toHaveBeenCalled ( ) ;
177177 } ) ;
178178} ) ;
179+
180+ describe ( 'JSON response serializer — boundary robustness (Variation 3)' , ( ) => {
181+ it ( 'verifies the utility catches the exception and reports format errors when passed non-serializable JSON payloads' , ( ) => {
182+ // Arrange: Create a non-serializable payload using a circular reference
183+ const circularStructure : Record < string , unknown > = { } ;
184+ circularStructure [ 'self' ] = circularStructure ;
185+
186+ // Provide a trim method that returns the circular structure to trigger the serialization error
187+ const nonSerializablePayload = {
188+ trim : ( ) => circularStructure ,
189+ } ;
190+
191+ // Act & Assert: Invoke the utility with the target inputs and verify it handles it gracefully
192+ expect ( ( ) => trackUser ( nonSerializablePayload as unknown as string ) ) . not . toThrow ( ) ;
193+ } ) ;
194+ } ) ;
You can’t perform that action at this time.
0 commit comments