mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(test): stabilize appcast version assertion
This commit is contained in:
@@ -5,16 +5,21 @@ import { canonicalSparkleBuildFromVersion } from "../scripts/sparkle-build.ts";
|
|||||||
const APPCAST_URL = new URL("../appcast.xml", import.meta.url);
|
const APPCAST_URL = new URL("../appcast.xml", import.meta.url);
|
||||||
|
|
||||||
describe("appcast.xml", () => {
|
describe("appcast.xml", () => {
|
||||||
it("uses the expected Sparkle version for 2026.3.1", () => {
|
it("uses canonical sparkle build for the latest stable appcast entry", () => {
|
||||||
const appcast = readFileSync(APPCAST_URL, "utf8");
|
const appcast = readFileSync(APPCAST_URL, "utf8");
|
||||||
const shortVersion = "2026.3.1";
|
const items = [...appcast.matchAll(/<item>([\s\S]*?)<\/item>/g)].map((match) => match[1] ?? "");
|
||||||
const items = Array.from(appcast.matchAll(/<item>[\s\S]*?<\/item>/g)).map((match) => match[0]);
|
expect(items.length).toBeGreaterThan(0);
|
||||||
const matchingItem = items.find((item) =>
|
|
||||||
item.includes(`<sparkle:shortVersionString>${shortVersion}</sparkle:shortVersionString>`),
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(matchingItem).toBeDefined();
|
const stableItem = items.find((item) => /<sparkle:version>\d+90<\/sparkle:version>/.test(item));
|
||||||
const sparkleMatch = matchingItem?.match(/<sparkle:version>([^<]+)<\/sparkle:version>/);
|
expect(stableItem).toBeDefined();
|
||||||
expect(sparkleMatch?.[1]).toBe(String(canonicalSparkleBuildFromVersion(shortVersion)));
|
|
||||||
|
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!)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user