import { describe, expect, it } from "vitest";
import { collectAppcastSparkleVersionErrors } from "../scripts/release-check.ts";
function makeItem(shortVersion: string, sparkleVersion: string): string {
return `- ${shortVersion}${shortVersion}${sparkleVersion}
`;
}
describe("collectAppcastSparkleVersionErrors", () => {
it("accepts legacy 9-digit calver builds before lane-floor cutover", () => {
const xml = `${makeItem("2026.2.26", "202602260")}`;
expect(collectAppcastSparkleVersionErrors(xml)).toEqual([]);
});
it("requires lane-floor builds on and after lane-floor cutover", () => {
const xml = `${makeItem("2026.3.1", "202603010")}`;
expect(collectAppcastSparkleVersionErrors(xml)).toEqual([
"appcast item '2026.3.1' has sparkle:version 202603010 below lane floor 2026030190.",
]);
});
it("accepts canonical stable lane builds on and after lane-floor cutover", () => {
const xml = `${makeItem("2026.3.1", "2026030190")}`;
expect(collectAppcastSparkleVersionErrors(xml)).toEqual([]);
});
});