Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Merge b39a92d into 3b03e8e
Browse files Browse the repository at this point in the history
  • Loading branch information
rochdev authored Dec 20, 2018
2 parents 3b03e8e + b39a92d commit 7d3168c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mock_tracer/mock_tracer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

// TODO: Move mock-tracer to its own NPM package once it is complete and tested.
import * as opentracing from '../index';
import MockContext from './mock_context';
import MockReport from './mock_report';
import MockSpan from './mock_span';

Expand Down Expand Up @@ -34,7 +35,7 @@ export class MockTracer extends opentracing.Tracer {
return span;
}

protected _inject(span: MockSpan, format: any, carrier: any): never {
protected _inject(span: MockContext, format: any, carrier: any): never {
throw new Error('NOT YET IMPLEMENTED');
}

Expand Down
18 changes: 18 additions & 0 deletions src/span_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
*/
export class SpanContext {
// The SpanContext is entirely implementation dependent

/**
* Returns a string representation of the internal vendor trace ID.
*
* @returns {string}
*/
toTraceId(): string {
return '';
}

/**
* Returns a string representation of the internal vendor span ID.
*
* @returns {string}
*/
toSpanId(): string {
return '';
}
}

export default SpanContext;
19 changes: 19 additions & 0 deletions src/test/api_compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,25 @@ function apiCompatibilityChecks(createTracer = () => new Tracer(), options: ApiC
expect(() => new Reference(REFERENCE_CHILD_OF, span.context())).to.not.throw(Error);
});
});

describe('SpanContext', () => {
describe('toTraceId', () => {
it('should return a string', () => {
span = tracer.startSpan('test-span');
console.log(span.context().toTraceId());
expect(() => span.context().toTraceId()).to.not.throw(Error);
expect(span.context().toTraceId()).to.be.a('string');
});
});

describe('toSpanId', () => {
it('should return a string', () => {
span = tracer.startSpan('test-span');
expect(() => span.context().toSpanId()).to.not.throw(Error);
expect(span.context().toSpanId()).to.be.a('string');
});
});
});
});
}

Expand Down

0 comments on commit 7d3168c

Please sign in to comment.