Files
Termix/scripts/fix-update-info.test.ts
T
62ac931468 v26.10.1 (#1599)
* feat: AI translations at release, 7 new languages and regional fallback

* fix: proper plural forms for count strings and full translations

* fix: plural forms for selected, hidden and active counts

* fix: synced plugin updates failing on desktop and server-only plugins shown as stopped

* fix: restore rounded corners on app icons and favicon

* feat: desktop app auto updates with automatic, ask first or never modes

* feat: community and custom plugin registries

* feat: plugin guide for AI tools in the SDK with a lint check

* fix: keep the terminal WebSocket open past nginx's 60s default (#1588)

* chore: update changelog

* feat: show plugin download counts only and stop CI builds inflating them

* feat: hide installed plugins in the browse tab by default

* chore: pin bundled plugins to latest releases

* chore: update translations

* fix: focusing a saved password field and saving no longer erases it

* fix: tell desktop users when their 2.8 data needs 2.9 first

* fix: point windows update info at the x64 installer

* fix: keep desktop client tunnel sockets alive behind proxies

* chore: pin bundled plugins to latest releases

* fix: cover client tunnel keepalive in the c2s runtime tests

* fix: typing after opening a host no longer goes to the host search

* fix: accept tab and = separators in SSH config import (#1598)

* chore: update changelog

* chore: drop plugin versions from core changelog

* chore: update translations

* chore: lint, format, and bump version to 26.10.1

---------

Co-authored-by: Darnel Hunter <68697450+innotelinc@users.noreply.github.com>
Co-authored-by: Iain <Iain1970@protonmail.com>
2026-10-12 11:35:48 -05:00

88 lines
2.5 KiB
TypeScript

import { createRequire } from "node:module";
import { describe, expect, it } from "vitest";
const require = createRequire(import.meta.url);
const { fixUpdateInfo, parseArgs } = require("./fix-update-info.cjs");
const info = {
version: "26.10.2",
files: [
{ url: "termix_windows_ia32_nsis.exe", sha512: "a", size: 1 },
{ url: "termix_windows_x64_nsis.exe", sha512: "b", size: 2 },
],
path: "termix_windows_ia32_nsis.exe",
sha512: "a",
releaseDate: "2026-10-11T00:00:00.000Z",
};
describe("fixUpdateInfo", () => {
it("drops entries and points path at what is left", () => {
const fixed = fixUpdateInfo(info, { drop: ["ia32"] });
expect(fixed.files.map((f: { url: string }) => f.url)).toEqual([
"termix_windows_x64_nsis.exe",
]);
expect(fixed.path).toBe("termix_windows_x64_nsis.exe");
expect(fixed.sha512).toBe("b");
expect(fixed.version).toBe("26.10.2");
});
it("drops the combined Windows installer and duplicate entries", () => {
const fixed = fixUpdateInfo(
{
...info,
files: [
{ url: "termix_windows_nsis.exe", sha512: "c", size: 3 },
{ url: "termix_windows_ia32_nsis.exe", sha512: "a", size: 1 },
{ url: "termix_windows_x64_nsis.exe", sha512: "b", size: 2 },
{ url: "termix_windows_x64_nsis.exe", sha512: "b", size: 2 },
],
path: "termix_windows_nsis.exe",
},
{ drop: ["ia32", "termix_windows_nsis.exe"] },
);
expect(fixed.files).toEqual([
{ url: "termix_windows_x64_nsis.exe", sha512: "b", size: 2 },
]);
expect(fixed.path).toBe("termix_windows_x64_nsis.exe");
});
it("follows renamed artifacts", () => {
const fixed = fixUpdateInfo(
{
...info,
files: [{ url: "termix_linux_x86_64_appimage.AppImage", sha512: "c" }],
},
{
rename: {
"termix_linux_x86_64_appimage.AppImage":
"termix_linux_x64_appimage.AppImage",
},
},
);
expect(fixed.path).toBe("termix_linux_x64_appimage.AppImage");
});
it("refuses to leave nothing to download", () => {
expect(() => fixUpdateInfo(info, { drop: ["nsis"] })).toThrow();
});
});
describe("parseArgs", () => {
it("reads drops, renames and files", () => {
expect(
parseArgs([
"--drop",
"ia32",
"--rename",
"a=b",
"latest.yml",
"beta.yml",
]),
).toEqual({
drop: ["ia32"],
rename: { a: "b" },
files: ["latest.yml", "beta.yml"],
});
});
});