feat(core-shared): IMetrics interface + NoopMetrics impl
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { NoopMetrics } from "./noop-metrics";
|
||||
|
||||
describe("NoopMetrics", () => {
|
||||
it("counter() returns undefined without throwing", () => {
|
||||
const metrics = new NoopMetrics();
|
||||
expect(() => metrics.counter("my.counter")).not.toThrow();
|
||||
expect(() => metrics.counter("my.counter", 5)).not.toThrow();
|
||||
expect(() =>
|
||||
metrics.counter("my.counter", 1, { feature: "auth", success: true }),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it("histogram() returns undefined without throwing", () => {
|
||||
const metrics = new NoopMetrics();
|
||||
expect(() => metrics.histogram("my.latency", 42)).not.toThrow();
|
||||
expect(() =>
|
||||
metrics.histogram("my.latency", 100, { route: "/api/me" }),
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it("gauge() returns undefined without throwing", () => {
|
||||
const metrics = new NoopMetrics();
|
||||
expect(() => metrics.gauge("queue.depth", 7)).not.toThrow();
|
||||
expect(() =>
|
||||
metrics.gauge("queue.depth", 3, { queue: "emails" }),
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user