@@ -256,17 +256,23 @@ describe("Opentracing interface", () => {
256
256
} ) ;
257
257
258
258
it ( "should log data" , ( ) => {
259
- span . log ( { event : "data_received" , data : "42" } ) ;
259
+ span . log ( " data to log" ) ;
260
260
261
261
// should do it in a scope
262
262
expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
263
263
zipkinTracer . scoped . mock . calls [ 0 ] [ 0 ] ( ) ;
264
264
265
- expect ( zipkinTracer . recordBinary ) . toHaveBeenCalledWith (
266
- "event" ,
267
- "data_received"
268
- ) ;
269
- expect ( zipkinTracer . recordBinary ) . toHaveBeenCalledWith ( "data" , "42" ) ;
265
+ expect ( zipkinTracer . recordMessage ) . toHaveBeenCalledWith ( "data to log" ) ;
266
+ } ) ;
267
+
268
+ it ( "should not log if empty data is passed" , ( ) => {
269
+ span . log ( ) ;
270
+
271
+ // should do it in a scope
272
+ expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
273
+ zipkinTracer . scoped . mock . calls [ 0 ] [ 0 ] ( ) ;
274
+
275
+ expect ( zipkinTracer . recordMessage ) . not . toHaveBeenCalled ( ) ;
270
276
} ) ;
271
277
272
278
it ( "should use the right id in log" , ( ) => {
@@ -276,7 +282,7 @@ describe("Opentracing interface", () => {
276
282
277
283
zipkinTracer . scoped . mockReset ( ) ;
278
284
zipkinTracer . setId . mockReset ( ) ;
279
- span . log ( { event : "other event" } ) ;
285
+ span . log ( "other event" ) ;
280
286
281
287
// should do it in a scope
282
288
expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
@@ -285,7 +291,7 @@ describe("Opentracing interface", () => {
285
291
zipkinTracer . scoped . mockReset ( ) ;
286
292
zipkinTracer . setId . mockReset ( ) ;
287
293
288
- otherSpan . log ( { event : "yet another event" } ) ;
294
+ otherSpan . log ( "yet another event" ) ;
289
295
// should do it in a scope
290
296
expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
291
297
zipkinTracer . scoped . mock . calls [ 0 ] [ 0 ] ( ) ;
0 commit comments