2026-02-17 10:42:42 -05:00
|
|
|
import { readFileSync } from "node:fs";
|
|
|
|
|
import { describe, expect, it } from "vitest";
|
2026-03-03 04:35:35 +00:00
|
|
|
import { canonicalSparkleBuildFromVersion } from "../scripts/sparkle-build.ts";
|
2026-02-17 10:42:42 -05:00
|
|
|
|
|
|
|
|
const APPCAST_URL = new URL("../appcast.xml", import.meta.url);
|
|
|
|
|
|
|
|
|
|
describe("appcast.xml", () => {
|
2026-03-03 05:48:00 +00:00
|
|
|
it("uses canonical sparkle build for the latest stable appcast entry", () => {
|
2026-02-17 10:42:42 -05:00
|
|
|
const appcast = readFileSync(APPCAST_URL, "utf8");
|
2026-03-03 05:48:00 +00:00
|
|
|
const items = [...appcast.matchAll(/<item>([\s\S]*?)<\/item>/g)].map((match) => match[1] ?? "");
|
|
|
|
|
expect(items.length).toBeGreaterThan(0);
|
2026-02-17 10:42:42 -05:00
|
|
|
|
2026-03-03 05:48:00 +00:00
|
|
|
const stableItem = items.find((item) => /<sparkle:version>\d+90<\/sparkle:version>/.test(item));
|
|
|
|
|
expect(stableItem).toBeDefined();
|
|
|
|
|
|
|
|
|
|
const shortVersion = stableItem?.match(
|
|
|
|
|
/<sparkle:shortVersionString>([^<]+)<\/sparkle:shortVersionString>/,
|
|
|
|
|
)?.[1];
|
|
|
|
|
const sparkleVersion = stableItem?.match(/<sparkle:version>([^<]+)<\/sparkle:version>/)?.[1];
|
|
|
|
|
|
|
|
|
|
expect(shortVersion).toBeDefined();
|
|
|
|
|
expect(sparkleVersion).toBeDefined();
|
|
|
|
|
expect(sparkleVersion).toBe(String(canonicalSparkleBuildFromVersion(shortVersion!)));
|
2026-02-17 10:42:42 -05:00
|
|
|
});
|
|
|
|
|
});
|