clawdie-ai/setup/cms.test.ts
Operator & Codex 247d4cdd0c Fix docs site navigation and Slovenian locale (Sam & Codex)
Autogenerate the docs sidebar from the public content tree, sync Slovenian docs into the Starlight content copy, remove stale Astro-only English and guide duplicates, use honest 404s for missing docs pages, and repair stale Codeberg links.

---

Build: pass

Tests: pass — 2221 passed (166 files)

---
Build: pass | Tests: pass — 2221 passed (656 files)
2026-05-08 17:31:40 +02:00

42 lines
1.7 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest';
import { makePlatformRegistryFixture } from '../src/test-fixtures/platform-registry.js';
import * as surfaceInventoryModule from '../src/surface-inventory.js';
import { nginxConf } from './cms.js';
describe('setup/cms nginxConf', () => {
it('builds explicit server blocks for cms admin and tenant surfaces', () => {
vi.spyOn(surfaceInventoryModule, 'buildSurfaceInventory').mockReturnValue(
surfaceInventoryModule.buildSurfaceInventory(
makePlatformRegistryFixture(),
),
);
const conf = nginxConf({ adminUiEnabled: true });
expect(conf).toContain('listen 80 default_server;');
expect(conf).toContain('server_name cms.home.arpa cms.clawdie.si;');
expect(conf).toContain('server_name clawdie.si www.clawdie.si;');
expect(conf).toContain('root /usr/local/www/clawdie-si;');
expect(conf).toContain('return 301 https://clawdie.si/en/;');
expect(conf).toContain('docs.clawdie.si');
expect(conf).toContain('blog.alpha.home.arpa');
expect(conf).toContain('alpha.home.arpa');
expect(conf).toContain('location /api/');
expect(conf).toContain('location /admin/');
expect(conf).toContain('try_files $uri $uri/ =404;');
expect(conf).toContain('location /screenshots/ {');
expect(conf).not.toContain('auth_basic_user_file');
});
it('returns 404 for admin/api paths when admin ui is disabled', () => {
const conf = nginxConf({ adminUiEnabled: false });
expect(conf).toContain('location /admin/ {');
expect(conf).toContain('location /api/ {');
expect(conf).toContain('return 404;');
expect(conf).not.toContain(
'proxy_pass http://127.0.0.1:1337/admin/;',
);
});
});