import { test } from 'node:test'; import assert from 'node:assert/strict'; import { fileURLToPath } from 'node:url'; process.env.CMS_CONFIG ||= fileURLToPath(new URL('../../examples/openbureau.config.js', import.meta.url)); process.env.SUPABASE_URL ||= 'http://localhost'; process.env.SUPABASE_SERVICE_KEY ||= 'x'; process.env.JWT_SECRET ||= 'x'; process.env.SITE_DIR ||= '/tmp/nosite'; const { systemInfo } = await import('../src/routes/system.js'); test('systemInfo reflects core version, plugins and content model', () => { const info = systemInfo({ version: '0.6.0', hugo: '0.161.1+extended' }); assert.equal(info.core.name, 'openbureau-core'); assert.equal(info.core.version, '0.6.0'); assert.equal(info.site, 'openbureau'); assert.equal(info.auth, 'supabase'); // openbureau.config.js sets auth: 'supabase' assert.equal(info.hugo, '0.161.1+extended'); // dialog plugin is active with its routes + the one migration const dialog = info.plugins.find((p) => p.name === 'dialog'); assert.ok(dialog, 'dialog plugin listed'); assert.ok(dialog.routes > 0); assert.equal(dialog.migrations, 1); // content model surfaced from the config collections assert.deepEqual(info.collections.map((c) => c.kind).sort(), ['beitrag', 'biblio', 'rubrik', 'seite']); const beitrag = info.collections.find((c) => c.kind === 'beitrag'); assert.equal(beitrag.label, 'Beiträge'); assert.ok(beitrag.fields > 0); });