release: WRNexusJS 0.8.2
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { createWebVitalsHandler, MetricsRegistry } from "../src/index.ts";
|
||||
import { createWebVitalsHandler, MetricsRegistry, webVitalsClient } from "../src/index.ts";
|
||||
|
||||
describe("@wrnexus/observability", () => {
|
||||
test("aggregates browser vitals and flushes them once at page exit", () => {
|
||||
const client = webVitalsClient({ sampleRate: 1 });
|
||||
expect(client).toContain("var flushed = false");
|
||||
expect(client).toContain('addEventListener("pagehide", flush');
|
||||
expect(client).not.toContain('send("INP",max)');
|
||||
expect(client).not.toContain('send("LCP", last.startTime)');
|
||||
});
|
||||
|
||||
test("records deterministic counters and histograms", () => {
|
||||
const registry = new MetricsRegistry(() => 123);
|
||||
registry.increment("requests", 1, { route: "/" });
|
||||
|
||||
Reference in New Issue
Block a user