mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
feat: plugin filters by type, paged browse, hide plugins needing newer termix
This commit is contained in:
1 parent
556f0406aa
commit
9d93fb0893
14 files changed
+1069
-223
No files matched your search
@@ -12,6 +12,10 @@ vi.mock("../../utils/safe-outbound-fetch.js", () => ({
|
||||
safeOutboundFetch: fetchMock,
|
||||
}));
|
||||
|
||||
vi.mock("../../utils/app-version.js", () => ({
|
||||
getLocalVersion: () => "26.10.3",
|
||||
}));
|
||||
|
||||
vi.mock("../../plugins/trust.js", async (importOriginal) => {
|
||||
const actual =
|
||||
await importOriginal<typeof import("../../plugins/trust.js")>();
|
||||
@@ -44,7 +48,9 @@ import {
|
||||
findRelease,
|
||||
latestOnChannel,
|
||||
getStatsUrl,
|
||||
canRunRelease,
|
||||
isApiCompatible,
|
||||
neededTermix,
|
||||
parseRegistryIndex,
|
||||
parseRegistryStats,
|
||||
resetRegistryCache,
|
||||
@@ -239,6 +245,56 @@ describe("findRelease", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("engine ranges", () => {
|
||||
const engine = (termix: string, api = "^1.0") => ({ api, termix });
|
||||
|
||||
it("reads gated releases into versions and prereleases", () => {
|
||||
const index = parseRegistryIndex({
|
||||
plugins: [
|
||||
{
|
||||
id: "classic-layout",
|
||||
versions: [],
|
||||
gated: [
|
||||
version({ version: "1.1.0-beta.1", engine: engine(">=26.10.3") }),
|
||||
version({ version: "1.0.0", engine: engine(">=26.10.3") }),
|
||||
],
|
||||
contributes: ["layouts", "tabs", "not valid"],
|
||||
},
|
||||
],
|
||||
});
|
||||
const [plugin] = index.plugins;
|
||||
expect(plugin.versions.map((v) => v.version)).toEqual(["1.0.0"]);
|
||||
expect(plugin.prereleases.map((v) => v.version)).toEqual(["1.1.0-beta.1"]);
|
||||
expect(plugin.contributes).toEqual(["layouts", "tabs"]);
|
||||
});
|
||||
|
||||
it("checks engine.termix and the full engine.api", () => {
|
||||
expect(canRunRelease(version({ engine: engine(">=26.10.3") }))).toBe(true);
|
||||
expect(canRunRelease(version({ engine: engine(">=26.11.0") }))).toBe(false);
|
||||
expect(neededTermix(version({ engine: engine(">=26.11.0") }))).toBe(
|
||||
">=26.11.0",
|
||||
);
|
||||
expect(neededTermix(version({ engine: engine(">=26.10.0") }))).toBeNull();
|
||||
expect(
|
||||
canRunRelease(version({ engine: engine(">=26.10.0", "^1.99") })),
|
||||
).toBe(false);
|
||||
expect(canRunRelease(version())).toBe(true);
|
||||
});
|
||||
|
||||
it("skips a release this build is too old for", () => {
|
||||
const index = parseRegistryIndex({
|
||||
plugins: [
|
||||
{
|
||||
id: "docker",
|
||||
versions: [version({ version: "1.0.0" })],
|
||||
gated: [version({ version: "1.1.0", engine: engine(">=26.11.0") })],
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(findRelease(index, "docker")?.release.version).toBe("1.0.0");
|
||||
});
|
||||
});
|
||||
|
||||
describe("prereleases", () => {
|
||||
const index = parseRegistryIndex({
|
||||
plugins: [
|
||||
|
||||
Reference in new issue
Block a user