Files
PerishFire 2ce9d09f41 Fix Windows launcher beta update lifecycle (#3960)
* fix windows beta updater acceptance harness

* fix: harden windows launcher beta updates

* fix: align launcher payload e2e relaunch stub

Generated-By: looper 0.9.5 (runner=fixer, agent=codex)

* fix: gate windows uninstall version sync

Generated-By: looper 0.9.5 (runner=fixer, agent=codex)

* fix: verify launcher payload before activation

Generated-By: looper 0.9.5 (runner=fixer, agent=codex)

---------

Co-authored-by: Looper <looper@noreply.github.com>
2026-06-09 06:00:59 +00:00

95 lines
2.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
syncWindowsUninstallDisplayVersion,
windowsUninstallDisplayVersionRegistryArgs,
windowsUninstallRegistryQueryArgs,
} from "../src/windows-lifecycle.js";
describe("Windows packaged lifecycle", () => {
it("builds the namespace-scoped uninstall DisplayVersion registry update", () => {
expect(windowsUninstallRegistryQueryArgs({
namespace: "release-beta-win",
})).toEqual([
"query",
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Open Design-release-beta-win",
]);
expect(windowsUninstallDisplayVersionRegistryArgs({
namespace: "release-beta-win",
version: "1.2.3-beta.4",
})).toEqual([
"add",
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Open Design-release-beta-win",
"/v",
"DisplayVersion",
"/t",
"REG_SZ",
"/d",
"1.2.3-beta.4",
"/f",
]);
});
it("syncs DisplayVersion on Windows without touching other platforms", async () => {
const calls: Array<{ args: string[]; command: string }> = [];
const exec = async (command: string, args: string[]) => {
calls.push({ args, command });
};
await expect(syncWindowsUninstallDisplayVersion({
exec,
namespace: "release-beta-win",
platform: "linux",
version: "1.2.3-beta.4",
})).resolves.toBe(false);
await expect(syncWindowsUninstallDisplayVersion({
exec,
namespace: "release-beta-win",
platform: "win32",
version: "",
})).resolves.toBe(false);
await expect(syncWindowsUninstallDisplayVersion({
exec,
namespace: "release-beta-win",
platform: "win32",
version: "1.2.3-beta.4",
})).resolves.toBe(true);
expect(calls).toEqual([{
args: windowsUninstallRegistryQueryArgs({
namespace: "release-beta-win",
}),
command: "reg.exe",
}, {
args: windowsUninstallDisplayVersionRegistryArgs({
namespace: "release-beta-win",
version: "1.2.3-beta.4",
}),
command: "reg.exe",
}]);
});
it("does not write DisplayVersion when the uninstall registry key is missing", async () => {
const calls: Array<{ args: string[]; command: string }> = [];
const exec = async (command: string, args: string[]) => {
calls.push({ args, command });
if (args[0] === "query") throw new Error("key not found");
};
await expect(syncWindowsUninstallDisplayVersion({
exec,
namespace: "release-beta-win",
platform: "win32",
version: "1.2.3-beta.4",
})).resolves.toBe(false);
expect(calls).toEqual([{
args: windowsUninstallRegistryQueryArgs({
namespace: "release-beta-win",
}),
command: "reg.exe",
}]);
});
});