mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
feat: pin the official plugins in the docker image
This commit is contained in:
1 parent
853615af09
commit
88d7bc5525
6 files changed
+329
-3
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
loadBundledPlugins,
|
||||
fetchArtifact,
|
||||
extractArtifact,
|
||||
pinsFromIndex,
|
||||
} from "./lib/bundled-plugins.cjs";
|
||||
|
||||
const cleanups: Array<() => void> = [];
|
||||
@@ -135,3 +136,59 @@ describe("tmxplug entries", () => {
|
||||
).rejects.toThrow(/is for "other"/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("pinsFromIndex", () => {
|
||||
const index = {
|
||||
plugins: [
|
||||
{
|
||||
id: "beta",
|
||||
versions: [
|
||||
{
|
||||
version: "1.1.0",
|
||||
url: "https://example.test/beta-1.1.0.tmxplug",
|
||||
sha256: "b".repeat(64),
|
||||
},
|
||||
{
|
||||
version: "1.0.0",
|
||||
url: "https://example.test/beta-1.0.0.tmxplug",
|
||||
sha256: SHA,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "alpha",
|
||||
versions: [
|
||||
{
|
||||
version: "1.0.0",
|
||||
url: "https://example.test/alpha-1.0.0.tmxplug",
|
||||
sha256: "c".repeat(64),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
it("pins the newest version of every plugin, sorted by id", () => {
|
||||
const pins = pinsFromIndex(index, null);
|
||||
expect(pins.map((pin) => pin.id)).toEqual(["alpha", "beta"]);
|
||||
expect(pins[1]).toEqual({
|
||||
id: "beta",
|
||||
source: "tmxplug",
|
||||
url: "https://example.test/beta-1.1.0.tmxplug",
|
||||
sha256: "b".repeat(64),
|
||||
});
|
||||
expect(parseBundledPlugins({ plugins: pins }).problems).toEqual([]);
|
||||
});
|
||||
|
||||
it("pins only the ids asked for", () => {
|
||||
expect(pinsFromIndex(index, ["beta"]).map((pin) => pin.id)).toEqual([
|
||||
"beta",
|
||||
]);
|
||||
});
|
||||
|
||||
it("refuses an id the index does not list", () => {
|
||||
expect(() => pinsFromIndex(index, ["gamma"])).toThrow(
|
||||
/not in the registry/,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user