import fs from 'fs'; import path from 'path'; import { PROJECT_ROOT } from '../src/paths'; // The server must work from any working directory (systemd, Docker, cron, // `node dist/index.js` launched from elsewhere), so every runtime path is // resolved from PROJECT_ROOT rather than process.cwd(). describe('PROJECT_ROOT', () => { it('points at the project root regardless of cwd', () => { expect(path.isAbsolute(PROJECT_ROOT)).toBe(true); expect(fs.existsSync(path.join(PROJECT_ROOT, 'package.json'))).toBe(true); }); it('resolves the OpenAPI spec served at /docs', () => { expect(fs.existsSync(path.join(PROJECT_ROOT, 'openapi.yaml'))).toBe(true); }); it('resolves the admin static assets served at /admin', () => { expect(fs.existsSync(path.join(PROJECT_ROOT, 'admin', 'index.html'))).toBe(true); }); });