@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
2
2
3
3
import {
4
4
createRequestId ,
5
- serializeValue ,
5
+ safeStringify ,
6
6
shortId ,
7
7
sizeOf ,
8
8
} from "@/logging/utils" ;
@@ -70,19 +70,19 @@ describe("Logging utils", () => {
70
70
} ) ;
71
71
} ) ;
72
72
73
- describe ( "serializeValue " , ( ) => {
73
+ describe ( "safeStringify " , ( ) => {
74
74
it ( "formats various data types" , ( ) => {
75
- expect ( serializeValue ( { key : "value" } ) ) . toContain ( "key: 'value'" ) ;
76
- expect ( serializeValue ( "plain text" ) ) . toContain ( "plain text" ) ;
77
- expect ( serializeValue ( [ 1 , 2 , 3 ] ) ) . toContain ( "1" ) ;
78
- expect ( serializeValue ( 123 ) ) . toContain ( "123" ) ;
79
- expect ( serializeValue ( true ) ) . toContain ( "true" ) ;
75
+ expect ( safeStringify ( { key : "value" } ) ) . toContain ( "key: 'value'" ) ;
76
+ expect ( safeStringify ( "plain text" ) ) . toContain ( "plain text" ) ;
77
+ expect ( safeStringify ( [ 1 , 2 , 3 ] ) ) . toContain ( "1" ) ;
78
+ expect ( safeStringify ( 123 ) ) . toContain ( "123" ) ;
79
+ expect ( safeStringify ( true ) ) . toContain ( "true" ) ;
80
80
} ) ;
81
81
82
82
it ( "handles circular references safely" , ( ) => {
83
83
const circular : Record < string , unknown > = { a : 1 } ;
84
84
circular . self = circular ;
85
- const result = serializeValue ( circular ) ;
85
+ const result = safeStringify ( circular ) ;
86
86
expect ( result ) . toBeTruthy ( ) ;
87
87
expect ( result ) . toContain ( "a: 1" ) ;
88
88
} ) ;
@@ -91,7 +91,7 @@ describe("Logging utils", () => {
91
91
const deep = {
92
92
level1 : { level2 : { level3 : { level4 : { value : "deep" } } } } ,
93
93
} ;
94
- const result = serializeValue ( deep ) ;
94
+ const result = safeStringify ( deep ) ;
95
95
expect ( result ) . toContain ( "level4: { value: 'deep' }" ) ;
96
96
} ) ;
97
97
} ) ;
0 commit comments