Files
nexu-io-open-design/packages/plugin-runtime/tests/validate.test.ts
pftom 4c7cd5d9f2 feat(plugins): introduce plugin system with installation and management capabilities
- Added support for a new plugin system, allowing users to install, uninstall, and manage plugins through the daemon.
- Implemented API endpoints for listing installed plugins, retrieving plugin details, and applying plugins with input validation.
- Introduced a plugin doctor feature to validate plugin manifests and check for issues before application.
- Established a plugin persistence layer with SQLite migrations for managing installed plugins and their metadata.
- Enhanced the CLI with commands for plugin operations, improving user interaction with the plugin ecosystem.
2026-05-09 18:24:44 +08:00

48 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { validateManifest } from '../src/validate';
describe('validateManifest', () => {
it('flags repeat=true without an until expression', () => {
const result = validateManifest({
name: 'x',
version: '1.0.0',
od: {
pipeline: { stages: [{ id: 'critique', atoms: ['critique-theater'], repeat: true }] },
},
});
expect(result.ok).toBe(false);
expect(result.errors.join(' ')).toMatch(/until/);
});
it('warns on unknown capability strings but stays ok', () => {
const result = validateManifest({
name: 'x',
version: '1.0.0',
od: { capabilities: ['prompt:inject', 'made-up'] },
});
expect(result.ok).toBe(true);
expect(result.warnings.some((w) => w.includes('made-up'))).toBe(true);
});
it('rejects an oauth surface that points at an undeclared connector', () => {
const result = validateManifest({
name: 'x',
version: '1.0.0',
od: {
connectors: { required: [{ id: 'slack', tools: [] }] },
genui: {
surfaces: [
{
id: 's1',
kind: 'oauth-prompt',
persist: 'project',
oauth: { route: 'connector', connectorId: 'notion' },
},
],
},
},
});
expect(result.ok).toBe(false);
});
});