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.2.27", "202602270")}`;
expect(collectAppcastSparkleVersionErrors(xml)).toEqual([
"appcast item '2026.2.27' has sparkle:version 202602270 below lane floor 2026022790.",
]);
});
it("accepts canonical stable lane builds on and after lane-floor cutover", () => {
const xml = `${makeItem("2026.2.27", "2026022790")}`;
expect(collectAppcastSparkleVersionErrors(xml)).toEqual([]);
});
});