30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
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();
|
|
});
|
|
});
|