Skip to content

Commit 6c2b641

Browse files
committed
fix unit tests
1 parent 6faa975 commit 6c2b641

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

‎src/trace/patch-console.spec.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ describe("patchConsole", () => {
4141
unpatchConsole(cnsole as any);
4242
});
4343

44-
it.each(["log", "info", "debug", "error", "warn", "trace"] as const)(
45-
"injects trace context into %s messages",
46-
(method) => {
47-
patchConsole(cnsole as any, contextService);
48-
cnsole[method]("Hello");
49-
expect(cnsole[method]).toHaveBeenCalledWith("[dd.trace_id=123456 dd.span_id=78910] Hello");
50-
},
51-
);
44+
it.each([
45+
{ method: "log", mock: () => log },
46+
{ method: "info", mock: () => info },
47+
{ method: "debug", mock: () => debug },
48+
{ method: "error", mock: () => error },
49+
{ method: "warn", mock: () => warn },
50+
{ method: "trace", mock: () => trace },
51+
] as const)("injects trace context into $method messages", ({ method, mock }) => {
52+
patchConsole(cnsole as any, contextService);
53+
cnsole[method]("Hello");
54+
expect(mock()).toHaveBeenCalledWith("[dd.trace_id=123456 dd.span_id=78910] Hello");
55+
});
5256

5357
it("doesn't inject trace context when none is present", () => {
5458
contextService["rootTraceContext"] = undefined as any;

0 commit comments

Comments
 (0)