Add project scaffolding and documentation
Add .env.example with configuration for database, Redis, security, SMTP, workers, and plugins. Add .gitignore for Python, Node.js, Next.js, Docker volumes, and IDE files. Add MIT License. Update README.md with feature overview, quick start guide, architecture description, plugin system documentation, security details, backup/restore instructions, and developer setup. Add Alembic configuration files and placeholder directories for API, web, worker, and plugin components
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { createManifest, defineWidget, validateManifest, REQUIRED_MANIFEST_FIELDS } from "../src";
|
||||
|
||||
const baseManifest = {
|
||||
id: "test-plugin",
|
||||
name: "Test Plugin",
|
||||
version: "1.0.0",
|
||||
nexadashPluginApi: "1.0",
|
||||
};
|
||||
|
||||
describe("plugin-sdk manifest", () => {
|
||||
it("createManifest applies defaults", () => {
|
||||
const manifest = createManifest(baseManifest);
|
||||
expect(manifest.name).toBe("Test Plugin");
|
||||
expect(manifest.nexadashPluginApi).toBe("1.0");
|
||||
expect(manifest.widgets).toEqual([]);
|
||||
expect(manifest.hasFrontend).toBe(false);
|
||||
});
|
||||
|
||||
it("defineWidget applies defaults", () => {
|
||||
const widget = defineWidget({
|
||||
id: "test-widget",
|
||||
name: "Test Widget",
|
||||
});
|
||||
expect(widget.defaultWidth).toBe(2);
|
||||
expect(widget.defaultHeight).toBe(2);
|
||||
});
|
||||
|
||||
it("validateManifest validates required fields", () => {
|
||||
const result = validateManifest(createManifest(baseManifest));
|
||||
expect(result.valid).toBe(true);
|
||||
});
|
||||
|
||||
it("validateManifest rejects invalid ids", () => {
|
||||
const result = validateManifest(
|
||||
createManifest({
|
||||
...baseManifest,
|
||||
id: "Test Plugin",
|
||||
})
|
||||
);
|
||||
expect(result.valid).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("REQUIRED_MANIFEST_FIELDS", () => {
|
||||
it("contains required keys", () => {
|
||||
expect(REQUIRED_MANIFEST_FIELDS).toContain("id");
|
||||
expect(REQUIRED_MANIFEST_FIELDS).toContain("name");
|
||||
expect(REQUIRED_MANIFEST_FIELDS).toContain("version");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user