/** * TRACES: UR-085 | DR-286 */ import { describe, it, expect } from "vitest"; import { compatibilityNotice } from "./serverCompatibility"; describe("server compatibility notice", () => { it("says nothing about a supported server", () => { expect(compatibilityNotice({ type: "supported" }, "12.0.0")).toBeNull(); }); it("does not interrupt anyone over a version it could not parse", () => { // Refusing, or even warning, on an unreadable version string would punish // the user for a parsing limitation of ours. expect(compatibilityNotice({ type: "unknownVersion" }, "weird-build")).toBeNull(); }); it("mentions a newer-than-known server without blocking it", () => { const notice = compatibilityNotice({ type: "newerThanKnown" }, "13.0.0"); expect(notice).not.toBeNull(); expect(notice!.blocking).toBe(false); expect(notice!.tone).toBe("warning"); expect(notice!.message).toContain("13.0.0"); }); it("blocks a server below the floor and names the floor", () => { const notice = compatibilityNotice({ type: "tooOld", minimum: "10.10" }, "10.9.11"); expect(notice).not.toBeNull(); expect(notice!.blocking).toBe(true); expect(notice!.tone).toBe("error"); expect(notice!.message).toContain("10.9.11"); expect(notice!.message).toContain("10.10"); }); });