feat(core-shared/instrumentation): withSpan returns Instrumented<F>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { describe, it, expect, expectTypeOf, vi } from "vitest";
|
||||
import { withSpan } from "@/instrumentation/with-span";
|
||||
import type { ITracer, ISpan, SpanOpts } from "@/instrumentation/tracer.interface";
|
||||
import type { Instrumented } from "@/conformance/brands";
|
||||
|
||||
function makeRecordingTracer() {
|
||||
const calls: SpanOpts[] = [];
|
||||
@@ -60,3 +61,12 @@ describe("withSpan", () => {
|
||||
expect(calls.every((c) => c.name === "test.same")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("withSpan — brand", () => {
|
||||
it("returns an Instrumented<F>", () => {
|
||||
const { tracer } = makeRecordingTracer();
|
||||
const fn = async (a: number) => a + 1;
|
||||
const wrapped = withSpan(tracer, { name: "test.brand", op: "use-case" }, fn);
|
||||
expectTypeOf(wrapped).toMatchTypeOf<Instrumented<typeof fn>>();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user