Enforce forward-only updates with downgrade protection and latest keyword normalization
Binaries / Build & Release Binaries (push) Has been cancelled
Binaries / Build & Release Binaries (push) Has been cancelled
This commit is contained in:
1 parent
63d579c273
commit
5dd337e671
3 files changed
+72
-14
No files matched your search
@@ -185,6 +185,24 @@ describe("CLI version & help handling", () => {
|
||||
expect(parsed.currentVersion).toBe(VERSION);
|
||||
expect(Array.isArray(parsed.releases)).toBe(true);
|
||||
});
|
||||
|
||||
test("rejects downgrade to older version when target version is lower", () => {
|
||||
const result = runCli(["update", "0.3.3"]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed.updated).toBe(false);
|
||||
expect(parsed.currentVersion).toBe(VERSION);
|
||||
expect(parsed.targetVersion).toBe("0.3.3");
|
||||
expect(parsed.message).toContain("Cannot downgrade seal-home");
|
||||
});
|
||||
|
||||
test("treats latest keyword as latest release without downgrade error", () => {
|
||||
const result = runCli(["update", "latest", "--check"]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed).toHaveProperty("latestVersion");
|
||||
expect(parsed.updated).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
function makeConfigEnv(): Record<string, string> {
|
||||
|
||||
Reference in new issue
Block a user