mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
feat: plugin docs and env manifest fields, in-app docs links, SDK 1.0.3
This commit is contained in:
1 parent
7fcda3bb01
commit
cfab6f764c
65 files changed
+1665
-294
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { DOCS_PAGES, DOCS_URL, docsUrl } from "@/lib/docs";
|
||||
|
||||
describe("docsUrl", () => {
|
||||
it("builds full links to core docs pages", () => {
|
||||
expect(docsUrl()).toBe(`${DOCS_URL}/`);
|
||||
expect(docsUrl("hosts")).toBe(`${DOCS_URL}/guide/hosts`);
|
||||
expect(docsUrl("portKnocking")).toBe(
|
||||
`${DOCS_URL}/guide/hosts#port-knocking`,
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps every page a relative path", () => {
|
||||
for (const path of Object.values(DOCS_PAGES)) {
|
||||
expect(path).not.toMatch(/^\/|^https?:/);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -108,6 +108,23 @@ describe("mergePlugins", () => {
|
||||
expect(mergePlugins([summary()], null)[0].features).toEqual([]);
|
||||
});
|
||||
|
||||
it("uses the installed docs link and falls back to the registry", () => {
|
||||
const registry = entry({ docs: "https://docs.example.com/registry" });
|
||||
expect(
|
||||
mergePlugins(
|
||||
[summary({ docs: "https://docs.example.com/installed" })],
|
||||
[registry],
|
||||
)[0].docs,
|
||||
).toBe("https://docs.example.com/installed");
|
||||
expect(mergePlugins([summary()], [registry])[0].docs).toBe(
|
||||
"https://docs.example.com/registry",
|
||||
);
|
||||
expect(mergePlugins([summary()], null)[0].docs).toBeUndefined();
|
||||
expect(mergePlugins([], [registry])[0].docs).toBe(
|
||||
"https://docs.example.com/registry",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps installed plugins when the registry is unreachable", () => {
|
||||
const rows = mergePlugins([summary()], null);
|
||||
expect(rows).toHaveLength(1);
|
||||
|
||||
Reference in new issue
Block a user