@@ -154,31 +154,28 @@ describe('traceEventCodec', () => {
154154 describe ( 'encode direction (memory object → JSON string)' , ( ) => {
155155 it ( 'should encode instant event to JSON string' , ( ) => {
156156 const encoded = traceEventCodec . encode ( instantEvent ) ;
157- expect ( typeof encoded ) . toBe ( 'string' ) ;
158157 const parsed = JSON . parse ( encoded ) ;
159158 expect ( parsed . args . detail ) . toBe ( JSON . stringify ( { custom : 'data' } ) ) ;
160159 expect ( parsed . args . data . detail ) . toBe ( JSON . stringify ( { nested : 'value' } ) ) ;
161160 } ) ;
162161
163162 it ( 'should encode span begin event to JSON string' , ( ) => {
164163 const encoded = traceEventCodec . encode ( spanBeginEvent ) ;
165- expect ( typeof encoded ) . toBe ( 'string' ) ;
166164 const decoded = traceEventCodec . decode ( encoded ) ;
167165 expect ( decoded ) . toStrictEqual ( spanBeginEvent ) ;
168166 } ) ;
169167
170168 it ( 'should encode span end event to JSON string' , ( ) => {
171169 const encoded = traceEventCodec . encode ( spanEndEvent ) ;
172- expect ( typeof encoded ) . toBe ( 'string' ) ;
173170 const decoded = traceEventCodec . decode ( encoded ) ;
174171 expect ( decoded ) . toStrictEqual ( spanEndEvent ) ;
175172 } ) ;
176173
177174 it ( 'should encode nested detail objects as JSON strings' , ( ) => {
178175 const encoded = traceEventCodec . encode ( instantEvent ) ;
179176 const parsed = JSON . parse ( encoded ) ;
180- expect ( typeof parsed . args . detail ) . toBe ( 'string' ) ;
181- expect ( typeof parsed . args . data . detail ) . toBe ( 'string' ) ;
177+ expect ( parsed . args . detail ) . toBeString ( ) ;
178+ expect ( parsed . args . data . detail ) . toBeString ( ) ;
182179 expect ( JSON . parse ( parsed . args . detail ) ) . toStrictEqual ( { custom : 'data' } ) ;
183180 expect ( JSON . parse ( parsed . args . data . detail ) ) . toStrictEqual ( {
184181 nested : 'value' ,
@@ -221,7 +218,7 @@ describe('traceEventCodec', () => {
221218describe ( 'generateTraceContent' , ( ) => {
222219 it ( 'should generate trace content for empty events array' , ( ) => {
223220 const events : TraceEvent [ ] = [ ] ;
224- const metadata = { version : '1.0.0' , generatedAt : '2024-01-01T00:00:00Z' } ;
221+ const metadata = { version : '1.0.0' } ;
225222
226223 const result = generateTraceContent ( events , metadata ) ;
227224
@@ -262,7 +259,6 @@ describe('generateTraceContent', () => {
262259 hardwareConcurrency : 1 ,
263260 dataOrigin : 'TraceEvents' ,
264261 version : '1.0.0' ,
265- generatedAt : expect . any ( String ) ,
266262 } ,
267263 } ) ;
268264 } ) ;
@@ -336,7 +332,6 @@ describe('generateTraceContent', () => {
336332 startTime : expect . any ( String ) ,
337333 hardwareConcurrency : 1 ,
338334 dataOrigin : 'TraceEvents' ,
339- generatedAt : expect . any ( String ) ,
340335 } ,
341336 } ) ;
342337 } ) ;
@@ -471,7 +466,6 @@ describe('traceEventWalFormat', () => {
471466 } ;
472467
473468 const encoded = format . codec . encode ( testEvent ) ;
474- expect ( typeof encoded ) . toBe ( 'string' ) ;
475469
476470 const decoded = format . codec . decode ( encoded ) ;
477471 expect ( decoded ) . toStrictEqual ( testEvent ) ;
@@ -519,25 +513,9 @@ describe('traceEventWalFormat', () => {
519513
520514 const result = format . finalizer ( records ) ;
521515
522- expect ( typeof result ) . toBe ( 'string' ) ;
523516 const parsed = JSON . parse ( result ) ;
524517 expect ( parsed ) . toHaveProperty ( 'traceEvents' ) ;
525518 expect ( parsed ) . toHaveProperty ( 'metadata' ) ;
526519 expect ( parsed . traceEvents ) . toBeArray ( ) ;
527520 } ) ;
528-
529- it ( 'should include generatedAt in finalizer metadata' , ( ) => {
530- const format = traceEventWalFormat ( ) ;
531- const records : TraceEvent [ ] = [ ] ;
532-
533- const result = format . finalizer ( records ) ;
534- const parsed = JSON . parse ( result ) ;
535-
536- expect ( parsed . metadata ) . toHaveProperty ( 'generatedAt' ) ;
537- expect ( typeof parsed . metadata . generatedAt ) . toBe ( 'string' ) ;
538- // Should be recent timestamp
539- expect ( new Date ( parsed . metadata . generatedAt ) . getTime ( ) ) . toBeGreaterThan (
540- Date . now ( ) - 10_000 ,
541- ) ;
542- } ) ;
543521} ) ;
0 commit comments