18 lines
590 B
TypeScript
18 lines
590 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createCorrelationId } from "./correlation";
|
|
|
|
describe("createCorrelationId", () => {
|
|
it("creates UUID-backed identifiers within the audit storage limit", () => {
|
|
const correlationId = createCorrelationId();
|
|
|
|
expect(correlationId).toMatch(
|
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
|
|
);
|
|
expect(correlationId.length).toBeLessThanOrEqual(64);
|
|
});
|
|
|
|
it("does not reuse an identifier for separate operations", () => {
|
|
expect(createCorrelationId()).not.toBe(createCorrelationId());
|
|
});
|
|
});
|