17 lines
1 KiB
TypeScript
17 lines
1 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest';
|
|
import { buildApp } from '../../src/app.js';
|
|
import { loadConfig } from '../../src/config.js';
|
|
|
|
const config = loadConfig({ DATABASE_URL: 'postgres://localhost/staff', REDIS_URL: 'redis://localhost:6379', STANDALONE_TENANT_ID: '01J00000000000000000000000', STANDALONE_ACTOR_ID: '01J00000000000000000000001', LOG_LEVEL: 'silent', NODE_ENV: 'test' });
|
|
const database = { ping: vi.fn(async () => undefined), close: vi.fn(async () => undefined) } as never;
|
|
|
|
describe('operational endpoints', () => {
|
|
it('reports liveness, readiness and version without domain APIs', async () => {
|
|
const app = await buildApp({ config, database });
|
|
expect((await app.inject('/live')).statusCode).toBe(200);
|
|
expect((await app.inject('/ready')).statusCode).toBe(200);
|
|
expect((await app.inject('/version')).json()).toMatchObject({ name: 'krona-staff', mode: 'standalone' });
|
|
expect((await app.inject('/api/v1/staff/payroll')).statusCode).toBe(404);
|
|
await app.close();
|
|
});
|
|
});
|