mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
d110b3bb6d
* fix(plugins): enforce manifest apiVersion at install and activation * test(plugins): exercise the absent-apiVersion default * feat(plugins): generate the core-event catalog into host-facts * docs(plugins): explain the packing.listBags write-permission binding * test(plugins): cover apiVersion upload refusal; tidy docblocks and generator header * fix(plugin-sdk): validate settings options and oauth like the host * fix(plugin-sdk): model the full manifest shape and stop dropping fields * fix(plugin-sdk): drop non-string routeProfiles icons like the host * docs(plugin-sdk): document host limits, oauth contract, and ignored asUserId * feat(plugin-sdk): enforce daily budgets and meta quotas in the mock host * feat(plugin-sdk): expose the generated core-event catalog * feat(plugin-sdk): scaffold trek range >=3.4.0 <5.0.0 ahead of TREK 4.0 * feat(plugin-sdk): scaffold the oauth broker settings for oauth:client plugins * chore(plugin-sdk): fix stale mirror docs and the colliding permissions export * docs(plugin-sdk): add the rate-limit string; restore trek docblock; match host meta sizing * feat(plugin-sdk): raise the scaffold trek floor to 4.0.0 * docs(wiki): bring the plugin pages in line with the current runtime * docs: bring the workspace CLAUDE.md guides up to date and make them committable * feat(plugin-sdk): roll back failed publishes, add unrelease, sync the fork, retro-sign updates * docs(wiki): document the publish rollback, unrelease, fork sync, and retro-signing * chore(plugin-sdk): 1.6.0
36 lines
1.9 KiB
TypeScript
36 lines
1.9 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { validateManifest } from '../src/manifest.js';
|
|
|
|
const base = () => ({ id: 'my-plugin', name: 'My Plugin', version: '1.0.0', type: 'integration', trek: '>=4.0.0 <5.0.0' });
|
|
const withSetting = (extra: object) => ({ ...base(), settings: [{ key: 'mode', ...extra }] });
|
|
|
|
describe('validateManifest settings[].options / settings[].oauth', () => {
|
|
it('accepts string/number option lists', () => {
|
|
expect(validateManifest(withSetting({ options: ['a', 'b'] })).ok).toBe(true);
|
|
expect(validateManifest(withSetting({ options: [1, 2] })).ok).toBe(true);
|
|
});
|
|
it('accepts {value,label} options incl. value 0', () => {
|
|
expect(validateManifest(withSetting({ options: [{ value: 0, label: 'Zero' }] })).ok).toBe(true);
|
|
});
|
|
it('rejects a non-array options', () => {
|
|
const r = validateManifest(withSetting({ options: 'a,b' }));
|
|
expect(r.ok).toBe(false);
|
|
expect(r.errors).toContain('settings option list must be an array');
|
|
});
|
|
it('rejects an option with empty value', () => {
|
|
const r = validateManifest(withSetting({ options: [{ value: '', label: 'x' }] }));
|
|
expect(r.errors).toContain('settings option must have a non-empty "value"');
|
|
});
|
|
it('rejects a garbage option entry', () => {
|
|
const r = validateManifest(withSetting({ options: [true] }));
|
|
expect(r.errors).toContain('invalid settings option true (expected a string or { value, label })');
|
|
});
|
|
it('rejects a non-object oauth', () => {
|
|
expect(validateManifest(withSetting({ oauth: 'x' })).errors).toContain('settings oauth must be an object');
|
|
});
|
|
it('rejects non-string oauth paths, accepts valid oauth', () => {
|
|
expect(validateManifest(withSetting({ oauth: { initPath: 3 } })).errors).toContain('settings oauth.initPath must be a string');
|
|
expect(validateManifest(withSetting({ oauth: { initPath: '/oauth/init' } })).ok).toBe(true);
|
|
});
|
|
});
|