mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +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
45 lines
2.1 KiB
TypeScript
45 lines
2.1 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { validateManifest } from '../src/manifest.js';
|
|
|
|
describe('validateManifest normalized output', () => {
|
|
it('normalized manifest keeps every recognized field', () => {
|
|
const input = {
|
|
id: 'my-plugin', name: 'My Plugin', version: '1.0.0', type: 'widget', trek: '>=4.0.0 <5.0.0',
|
|
permissions: ['db:own'], operatorEgress: false, icon: 'Bell', author: 'A', description: 'Does things.',
|
|
homepage: 'https://example.com', tags: ['fun'], license: 'MIT',
|
|
capabilities: { widget: { title: 'W', slot: 'hero' }, provides: ['getState'] },
|
|
settings: [{ key: 'mode', scope: 'user', options: ['a', 'b'] }],
|
|
actions: [{ key: 'ping', label: 'Ping' }],
|
|
};
|
|
const r = validateManifest(input);
|
|
expect(r.ok).toBe(true);
|
|
const m = r.manifest!;
|
|
expect(m.capabilities?.widget?.slot).toBe('hero');
|
|
expect(m.settings?.[0].options).toEqual(['a', 'b']);
|
|
expect(m.actions?.[0]).toEqual({ key: 'ping', label: 'Ping' });
|
|
expect(m.icon).toBe('Bell');
|
|
expect(m.operatorEgress).toBe(false);
|
|
expect(m.nativeModules).toBe(false); // still forced
|
|
expect(m.apiVersion).toBe(1); // still defaulted
|
|
expect(m.requiredAddons).toEqual([]);
|
|
});
|
|
|
|
it('accepts routeProfiles icon', () => {
|
|
const r = validateManifest({
|
|
id: 'rt-plug', name: 'R', version: '1.0.0', type: 'integration', trek: '>=4.0.0 <5.0.0',
|
|
permissions: ['hook:route-provider'], capabilities: { routeProfiles: [{ id: 'hike', label: 'Hiking', icon: 'Mountain' }] },
|
|
});
|
|
expect(r.ok).toBe(true);
|
|
expect(r.manifest!.capabilities?.routeProfiles?.[0].icon).toBe('Mountain');
|
|
});
|
|
|
|
it('drops a non-string routeProfiles icon instead of rejecting the manifest', () => {
|
|
const r = validateManifest({
|
|
id: 'rt-plug', name: 'R', version: '1.0.0', type: 'integration', trek: '>=4.0.0 <5.0.0',
|
|
permissions: ['hook:route-provider'], capabilities: { routeProfiles: [{ id: 'hike', label: 'Hiking', icon: 42 }] },
|
|
});
|
|
expect(r.ok).toBe(true);
|
|
expect(r.manifest!.capabilities?.routeProfiles?.[0].icon).toBeUndefined();
|
|
});
|
|
});
|