@@ -256,17 +256,23 @@ describe("Opentracing interface", () => {
256256 } ) ;
257257
258258 it ( "should log data" , ( ) => {
259- span . log ( { event : "data_received" , data : "42" } ) ;
259+ span . log ( " data to log" ) ;
260260
261261 // should do it in a scope
262262 expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
263263 zipkinTracer . scoped . mock . calls [ 0 ] [ 0 ] ( ) ;
264264
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 ( ) ;
270276 } ) ;
271277
272278 it ( "should use the right id in log" , ( ) => {
@@ -276,7 +282,7 @@ describe("Opentracing interface", () => {
276282
277283 zipkinTracer . scoped . mockReset ( ) ;
278284 zipkinTracer . setId . mockReset ( ) ;
279- span . log ( { event : "other event" } ) ;
285+ span . log ( "other event" ) ;
280286
281287 // should do it in a scope
282288 expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
@@ -285,7 +291,7 @@ describe("Opentracing interface", () => {
285291 zipkinTracer . scoped . mockReset ( ) ;
286292 zipkinTracer . setId . mockReset ( ) ;
287293
288- otherSpan . log ( { event : "yet another event" } ) ;
294+ otherSpan . log ( "yet another event" ) ;
289295 // should do it in a scope
290296 expect ( zipkinTracer . scoped ) . toHaveBeenCalled ( ) ;
291297 zipkinTracer . scoped . mock . calls [ 0 ] [ 0 ] ( ) ;
0 commit comments