11/**
2- * Copyright 2017 Google Inc. All Rights Reserved.
2+ * Copyright 2018 Google Inc. All Rights Reserved.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -23,10 +23,7 @@ let assert = require('assert');
2323
2424describe ( 'Tracer' , function ( ) {
2525 const options = { name : "test" } ;
26- const callback = ( root ) => {
27-
28- return root ;
29- }
26+ const callback = ( root ) => { return root ; }
3027
3128 describe ( 'new Tracer()' , function ( ) {
3229 it ( 'should create a Tracer instance' , function ( ) {
@@ -52,35 +49,27 @@ describe('Tracer', function () {
5249 describe ( 'startRootSpan()' , function ( ) {
5350
5451 it ( 'should start the rootSpan' , function ( ) {
55- const tracer = new Tracer ( ) ;
56- tracer . start ( ) ;
57- const root = tracer . startRootSpan ( options , callback ) ;
58-
59- assert . ok ( root . started ) ;
60- } ) ;
61-
62- it ( 'should set the new span root as currentRootSpan' , function ( ) {
63- const tracer = new Tracer ( ) ;
52+ let tracer = new Tracer ( ) ;
6453 tracer . start ( ) ;
65- const root = tracer . startRootSpan ( options , callback ) ;
54+ let rootSpan = tracer . startRootSpan ( options , callback ) ;
6655
67- assert . equal ( tracer . currentRootSpan . id , root . id ) ;
56+ assert . ok ( rootSpan . started ) ;
6857 } ) ;
6958 } ) ;
7059
7160 describe ( 'end()' , function ( ) {
7261 it ( 'should end current trace' , function ( ) {
73- const tracer = new Tracer ( ) ;
74- const trace = tracer . startRootSpan ( options , callback ) ;
75- trace . end ( ) ;
76- assert . ok ( trace . ended ) ;
62+ let tracer = new Tracer ( ) ;
63+ let rootSpan = tracer . startRootSpan ( options , callback ) ;
64+ rootSpan . end ( ) ;
65+ assert . ok ( rootSpan . ended ) ;
7766 } ) ;
7867 } ) ;
7968
8069 describe ( 'clearCurrentRootSpan()' , function ( ) {
8170 it ( 'should set the current root span to null' , function ( ) {
82- const tracer = new Tracer ( ) ;
83- const trace = tracer . startRootSpan ( options , callback ) ;
71+ let tracer = new Tracer ( ) ;
72+ let rootSpan = tracer . startRootSpan ( options , callback ) ;
8473 tracer . clearCurrentTrace ( ) ;
8574
8675 assert . ok ( tracer . currentRootSpan == null ) ;
@@ -89,19 +78,16 @@ describe('Tracer', function () {
8978
9079 describe ( 'startSpan()' , function ( ) {
9180 it ( 'should return a Span instance' , function ( ) {
92- const tracer = new Tracer ( ) ;
93- const trace = tracer . startRootSpan ( options , callback ) ;
94- trace . start ( ) ;
95- const span = tracer . startSpan ( "spanName" , "spanType" ) ;
96- console . log ( span ) ;
81+ let tracer = new Tracer ( ) ;
82+ let rootSpan = tracer . startRootSpan ( options , callback ) ;
83+ let span = tracer . startSpan ( "spanName" , "spanType" ) ;
9784 assert . ok ( span instanceof Span ) ;
9885 } ) ;
9986
10087 it ( 'should start a span' , function ( ) {
101- const tracer = new Tracer ( ) ;
102- const trace = tracer . startRootSpan ( options , callback ) ;
103- trace . start ( ) ;
104- const span = tracer . startSpan ( "spanName" , "spanType" ) ;
88+ let tracer = new Tracer ( ) ;
89+ let rootSpan = tracer . startRootSpan ( options , callback ) ;
90+ let span = tracer . startSpan ( "spanName" , "spanType" ) ;
10591 assert . ok ( span . started ) ;
10692 } ) ;
10793 } ) ;
0 commit comments