Files
modelstudioai__cli/tools/release/lib/binary-options.test.mjs
T

40 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-08-03 14:42:31 +08:00
import { describe, expect, test } from "vite-plus/test";
2026-07-31 18:53:37 +08:00
import {
channelManifestFileName,
normalizeModeChannel,
rollingChannelReleaseTag,
rollingManifestChannelId,
rollingManifestFileName,
STABLE_ROLLING_CHANNEL,
SYNC_RELEASE_CHANNEL,
} from "./binary-options.mjs";
describe("rolling CDN manifest naming", () => {
2026-08-03 14:42:31 +08:00
test("keeps sync-release and latest constants", () => {
expect(SYNC_RELEASE_CHANNEL).toBe("sync-release");
expect(STABLE_ROLLING_CHANNEL).toBe("latest");
2026-07-31 18:53:37 +08:00
});
2026-08-03 14:42:31 +08:00
test("channel mode always rolls sync-release.json regardless of npm dist-tag", () => {
2026-07-31 18:53:37 +08:00
const { mode, channel } = normalizeModeChannel("channel", "mcp");
2026-08-03 14:42:31 +08:00
expect(mode).toBe("channel");
expect(channel).toBe("mcp");
expect(rollingManifestFileName(mode)).toBe("sync-release.json");
expect(rollingManifestChannelId(mode)).toBe("sync-release");
expect(rollingChannelReleaseTag(mode)).toBe("channel-sync-release");
2026-07-31 18:53:37 +08:00
});
2026-08-03 14:42:31 +08:00
test("stable mode rolls latest.json for maintainReleaseManifest input", () => {
2026-07-31 18:53:37 +08:00
const { mode, channel } = normalizeModeChannel("stable", null);
2026-08-03 14:42:31 +08:00
expect(mode).toBe("stable");
expect(channel).toBeNull();
expect(rollingManifestFileName(mode)).toBe("latest.json");
expect(rollingManifestChannelId(mode)).toBe("latest");
2026-07-31 18:53:37 +08:00
});
2026-08-03 14:42:31 +08:00
test("channelManifestFileName still formats arbitrary names for helpers", () => {
expect(channelManifestFileName("release-test")).toBe("release-test.json");
expect(channelManifestFileName(SYNC_RELEASE_CHANNEL)).toBe("sync-release.json");
2026-07-31 18:53:37 +08:00
});
});