UNPKG

opentracing

Version:

[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![NPM Published Version][npm-img]][npm] ![Node Version][node-img] [![Join the chat at https://gitter.im/opentracing/opentracing-javascript](https://badges.gitter.im/opentracing/opentracing-

37 lines (29 loc) 1.24 kB
import { expect } from 'chai'; import { FORMAT_TEXT_MAP, initGlobalTracer, Tracer } from '../index'; export function noopImplementationTests(createTracer = () => new Tracer()): void { describe('Noop Tracer Implementation', () => { describe('Tracer#inject', () => { it('should handle Spans and SpanContexts', () => { const tracer = createTracer(); const span = tracer.startSpan('test_operation'); const textCarrier = {}; expect(() => { tracer.inject(span, FORMAT_TEXT_MAP, textCarrier); }).to.not.throw(Error); }); }); describe('Span#finish', () => { it('should return undefined', () => { const tracer = createTracer(); const span = tracer.startSpan('test_span'); expect(span.finish()).to.be.undefined; }); }); describe('Miscellaneous', () => { describe('Memory usage', () => { it('should not report leaks after setting the global tracer', () => { initGlobalTracer(createTracer()); }); }); }); }); } export default noopImplementationTests;