mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
2fe80ebc2d
Shell (Next.js): landing page, integrations explorer, docs viewer, AG-UI docs, feature matrix, search, demo drawer with Frontend/Backend tabs, profile pages with Live Demo / Code / Docs starter tabs. 17 integration packages with Dockerfiles, QA, tests, manifests. Build scripts for registry, demo content, starter content, search index. E2E smoke test suite (52 tests across 4 levels). Purple color scheme, independent sidebar scrolling, integration ordering by importance, category grouping, placeholder logos. Docs: 500+ MDX pages with snippet inlining, remark-gfm, rehype-highlight, AG-UI sidebar navigation, LFS images.
48 lines
1.8 KiB
TypeScript
48 lines
1.8 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import yaml from "yaml";
|
|
import { validateManifestConstraints } from "../validate-constraints.js";
|
|
|
|
const CONSTRAINTS_PATH = path.resolve(__dirname, "..", "..", "shared", "constraints.yaml");
|
|
const FIXTURES_DIR = path.resolve(__dirname, "fixtures");
|
|
|
|
function loadConstraints() {
|
|
return yaml.parse(fs.readFileSync(CONSTRAINTS_PATH, "utf-8"));
|
|
}
|
|
|
|
function loadFixture(name: string) {
|
|
return yaml.parse(fs.readFileSync(path.join(FIXTURES_DIR, name), "utf-8"));
|
|
}
|
|
|
|
describe("Constraint Validator", () => {
|
|
const constraints = loadConstraints();
|
|
|
|
it("passes a valid manifest", () => {
|
|
const manifest = loadFixture("valid-manifest.yaml");
|
|
const errors = validateManifestConstraints(manifest, constraints);
|
|
expect(errors).toEqual([]);
|
|
});
|
|
|
|
it("rejects a demo not allowed by declared generative_ui", () => {
|
|
const manifest = loadFixture("invalid-genui-manifest.yaml");
|
|
const errors = validateManifestConstraints(manifest, constraints);
|
|
expect(errors.length).toBeGreaterThan(0);
|
|
expect(errors[0]).toContain("tool-rendering");
|
|
expect(errors[0]).toContain("not allowed");
|
|
});
|
|
|
|
it("skips validation when generative_ui is missing", () => {
|
|
const manifest = loadFixture("missing-genui-manifest.yaml");
|
|
const errors = validateManifestConstraints(manifest, constraints);
|
|
expect(errors).toEqual([]);
|
|
});
|
|
|
|
it("rejects a demo ID not in any allowed list", () => {
|
|
const manifest = loadFixture("unknown-demo-manifest.yaml");
|
|
const errors = validateManifestConstraints(manifest, constraints);
|
|
expect(errors.length).toBeGreaterThan(0);
|
|
expect(errors[0]).toContain("nonexistent-feature");
|
|
});
|
|
});
|