import { readFileSync } from 'node:fs' import { resolve } from 'node:path' import { describe, expect, it } from 'vitest' import { validateUiPlugin, type HoloLakeUiPlugin } from './uiPluginSystem' type Registry = { schema: string plugins: Array<{ id: string; version: string; path: string }> } describe('registered UI plugins', () => { it('resolve to valid packages with matching immutable identities', () => { const root = resolve(process.cwd(), 'ui-plugins') const registry = JSON.parse(readFileSync(resolve(root, 'registry.json'), 'utf8')) as Registry expect(registry.schema).toBe('hololake.ui-plugin-registry/v1') expect(registry.plugins.length).toBeGreaterThan(0) for (const entry of registry.plugins) { const plugin = JSON.parse(readFileSync(resolve(root, entry.path), 'utf8')) as HoloLakeUiPlugin expect(plugin.manifest.id).toBe(entry.id) expect(plugin.manifest.version).toBe(entry.version) expect(validateUiPlugin(plugin)).toEqual({ ok: true, errors: [] }) } }) })