Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
+51
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import {
|
||||
getPluginCapabilityMetadata,
|
||||
getUnavailablePluginCapabilityNames,
|
||||
isPluginCapabilityHostBindingAvailable,
|
||||
PLUGIN_AVAILABLE_HOST_CAPABILITY_NAMES,
|
||||
PLUGIN_CAPABILITY_METADATA,
|
||||
} from "./capabilities.js";
|
||||
|
||||
describe("plugin host capability availability", () => {
|
||||
test("marks only reviewed sandbox host bindings as production-available", () => {
|
||||
expect(PLUGIN_AVAILABLE_HOST_CAPABILITY_NAMES).toEqual(["log", "audit"]);
|
||||
expect(isPluginCapabilityHostBindingAvailable("log")).toBe(true);
|
||||
expect(isPluginCapabilityHostBindingAvailable("audit")).toBe(true);
|
||||
expect(isPluginCapabilityHostBindingAvailable("http.outbound")).toBe(false);
|
||||
expect(isPluginCapabilityHostBindingAvailable("secret.read")).toBe(false);
|
||||
});
|
||||
|
||||
test("returns sorted unique unavailable capabilities from manifests or names", () => {
|
||||
expect(
|
||||
getUnavailablePluginCapabilityNames([
|
||||
{ name: "log" },
|
||||
{ name: "secret.read" },
|
||||
{ name: "http.outbound" },
|
||||
{ name: "secret.read" },
|
||||
"db.write",
|
||||
"not-a-capability",
|
||||
])
|
||||
).toEqual(["db.write", "http.outbound", "secret.read"]);
|
||||
});
|
||||
|
||||
test("exposes operator-facing capability risk and production availability metadata", () => {
|
||||
expect(Object.keys(PLUGIN_CAPABILITY_METADATA).sort()).toEqual([
|
||||
"audit",
|
||||
"db.read",
|
||||
"db.write",
|
||||
"http.outbound",
|
||||
"log",
|
||||
"secret.read",
|
||||
"storage.read",
|
||||
"storage.write",
|
||||
"tenant.info",
|
||||
]);
|
||||
expect(getPluginCapabilityMetadata("log")).toMatchObject({ risk: "low", productionAvailable: true });
|
||||
expect(getPluginCapabilityMetadata("audit")).toMatchObject({ risk: "medium", productionAvailable: true });
|
||||
expect(getPluginCapabilityMetadata("http.outbound")).toMatchObject({ risk: "high", productionAvailable: false });
|
||||
expect(getPluginCapabilityMetadata("secret.read")).toMatchObject({ risk: "critical", productionAvailable: false });
|
||||
expect(getPluginCapabilityMetadata("hook:workflow.created")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user