How to use the dd-trace/packages/dd-trace/src/opentracing/span_context.mockImplementation function in dd-trace

To help you get started, we’ve selected a few dd-trace examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moleculerjs / moleculer / test / unit / tracing / exporters / datadog.spec.js View on Github external
toSpanId: jest.fn(() => "span-id")
};

const fakeDdSpan = {
	log: jest.fn(),
	setTag: jest.fn(),
	context: jest.fn(() => fakeSpanContext),
	finish: jest.fn()
};

const fakeDdTracer = {
	scope: jest.fn(() => fakeTracerScope),
	startSpan: jest.fn(() => fakeDdSpan)
};

DatadogSpanContext.mockImplementation(opts => opts);

const DatadogTraceExporter = require("../../../../src/tracing/exporters/datadog");
const ServiceBroker = require("../../../../src/service-broker");
const Tracer = require("../../../../src/tracing/tracer");
const { MoleculerRetryableError } = require("../../../../src/errors");

const broker = new ServiceBroker({ logger: false });

describe("Test Datadog tracing exporter class", () => {

	describe("Test Constructor", () => {

		it("should create with default options", () => {
			const exporter = new DatadogTraceExporter();

			expect(exporter.opts).toEqual({