mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 06:47:28 +00:00
Scaffold LogicSRC and CommandBoard plugins
This commit is contained in:
parent
59927e140c
commit
5c9ea821f6
67 changed files with 5958 additions and 0 deletions
33
packages/plugin-core/src/index.test.ts
Normal file
33
packages/plugin-core/src/index.test.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { createPluginRegistry } from "./index.js";
|
||||
import type { PluginDefinition } from "./types.js";
|
||||
|
||||
const examplePlugin: PluginDefinition = {
|
||||
manifest: {
|
||||
id: "example",
|
||||
name: "Example",
|
||||
version: "1.0.0",
|
||||
type: ["testing"],
|
||||
default: false,
|
||||
capabilities: ["tests.run"],
|
||||
commands: ["test"],
|
||||
env: ["EXAMPLE_TOKEN"]
|
||||
}
|
||||
};
|
||||
|
||||
describe("PluginRegistry", () => {
|
||||
it("indexes enabled plugins by capability", () => {
|
||||
const registry = createPluginRegistry([examplePlugin]);
|
||||
|
||||
expect(registry.byCapability("tests.run")).toHaveLength(1);
|
||||
expect(registry.snapshot().capabilities["tests.run"]).toEqual(["example"]);
|
||||
});
|
||||
|
||||
it("honors disabled config", () => {
|
||||
const registry = createPluginRegistry([examplePlugin], {
|
||||
example: { enabled: false }
|
||||
});
|
||||
|
||||
expect(registry.enabled()).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue