Beta testers had to find prerelease assets on GitHub by hand. The download page now carries a Stable/Beta switch, with stable staying the default and the canonical URL. The channel lives in the URL (?channel=beta) rather than client state so maintainers can link someone straight to it. That link outlives the beta it was shared for, so the switch only renders while the newest prerelease leads stable on its core version, and a stale ?channel=beta falls back to stable instead of serving a promoted version twice. "What's new" deep-links the minor group anchor (/changelog#release-0.3), not the exact entry: promotion rewrites the -beta.N entry in place, so that anchor dies while the group survives — and the group is the stable-to-beta diff a beta downloader came to read. A version missing from the bundled changelog links plain /changelog rather than a dead anchor, which covers the window between a tag going public and the site redeploying. Homebrew, the app stores, and the web app have no beta, so the Beta view drops those rows instead of showing inert placeholders.
96 lines
2.8 KiB
TypeScript
96 lines
2.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
getLatestAndroidVersionFromReleases,
|
|
selectReleaseChannels,
|
|
type GitHubRelease,
|
|
} from "./latest-release";
|
|
|
|
function release({
|
|
version,
|
|
hasApk,
|
|
prerelease = false,
|
|
}: {
|
|
version: string;
|
|
hasApk: boolean;
|
|
prerelease?: boolean;
|
|
}): GitHubRelease {
|
|
const tag = `v${version}`;
|
|
return {
|
|
tag_name: tag,
|
|
assets: hasApk ? [{ name: `paseo-${tag}-android.apk` }] : [],
|
|
prerelease,
|
|
draft: false,
|
|
};
|
|
}
|
|
|
|
function desktopRelease({
|
|
version,
|
|
prerelease = false,
|
|
draft = false,
|
|
}: {
|
|
version: string;
|
|
prerelease?: boolean;
|
|
draft?: boolean;
|
|
}): GitHubRelease {
|
|
return {
|
|
tag_name: `v${version}`,
|
|
assets: [
|
|
{ name: `Paseo-${version}-arm64.dmg` },
|
|
{ name: "Paseo-x86_64.AppImage" },
|
|
{ name: `Paseo-Setup-${version}-x64.exe` },
|
|
{ name: `Paseo-Setup-${version}-arm64.exe` },
|
|
],
|
|
prerelease,
|
|
draft,
|
|
};
|
|
}
|
|
|
|
describe("getLatestAndroidVersionFromReleases", () => {
|
|
it("selects the latest stable release that contains an Android APK", () => {
|
|
const releases = [
|
|
release({ version: "0.1.109", hasApk: true, prerelease: true }),
|
|
release({ version: "0.1.108", hasApk: false }),
|
|
release({ version: "0.1.107", hasApk: true }),
|
|
];
|
|
|
|
expect(getLatestAndroidVersionFromReleases(releases)).toBe("0.1.107");
|
|
});
|
|
});
|
|
|
|
describe("selectReleaseChannels", () => {
|
|
it("offers the newest prerelease when it leads stable", () => {
|
|
const channels = selectReleaseChannels([
|
|
desktopRelease({ version: "0.3.0-beta.2", prerelease: true }),
|
|
desktopRelease({ version: "0.3.0-beta.1", prerelease: true }),
|
|
desktopRelease({ version: "0.2.5" }),
|
|
]);
|
|
|
|
expect(channels.stable.version).toBe("0.2.5");
|
|
expect(channels.beta?.version).toBe("0.3.0-beta.2");
|
|
expect(channels.beta?.windowsArm64Asset).toBe("Paseo-Setup-0.3.0-beta.2-arm64.exe");
|
|
});
|
|
|
|
it("retires the beta channel once stable ships the same version", () => {
|
|
const channels = selectReleaseChannels([
|
|
desktopRelease({ version: "0.3.0" }),
|
|
desktopRelease({ version: "0.3.0-beta.2", prerelease: true }),
|
|
]);
|
|
|
|
expect(channels.stable.version).toBe("0.3.0");
|
|
expect(channels.beta).toBeNull();
|
|
});
|
|
|
|
it("skips drafts and releases whose desktop assets are still uploading", () => {
|
|
const channels = selectReleaseChannels([
|
|
desktopRelease({ version: "0.3.0-beta.3", prerelease: true, draft: true }),
|
|
release({ version: "0.3.0-beta.2", hasApk: true, prerelease: true }),
|
|
desktopRelease({ version: "0.3.0-beta.1", prerelease: true }),
|
|
release({ version: "0.2.5", hasApk: true }),
|
|
desktopRelease({ version: "0.2.4" }),
|
|
]);
|
|
|
|
expect(channels.stable.version).toBe("0.2.4");
|
|
expect(channels.beta?.version).toBe("0.3.0-beta.1");
|
|
});
|
|
});
|