23 lines
664 B
TypeScript
23 lines
664 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
meetsTrustTier,
|
|
normalizeTrustTier,
|
|
promoteTrustTier,
|
|
} from "./trust.js";
|
|
|
|
describe("trust tiers", () => {
|
|
it("compares minimum trust tiers", () => {
|
|
expect(meetsTrustTier("T2", "T2")).toBe(true);
|
|
expect(meetsTrustTier("T1", "T2")).toBe(false);
|
|
expect(meetsTrustTier("T4", "T2")).toBe(true);
|
|
});
|
|
|
|
it("normalizes and promotes tiers monotonically", () => {
|
|
expect(normalizeTrustTier("T3", "T1")).toBe("T3");
|
|
expect(normalizeTrustTier("bad", "T1")).toBe("T1");
|
|
expect(promoteTrustTier("T1", "T2")).toBe("T2");
|
|
expect(promoteTrustTier("T3", "T2")).toBe("T3");
|
|
});
|
|
});
|