20 lines
663 B
JavaScript
20 lines
663 B
JavaScript
import { test, describe } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { app } from '../src/index.js';
|
|
|
|
describe('API routes integration', () => {
|
|
test('GET /healthz returns 200 and healthy JSON', async () => {
|
|
const res = await app.request('/healthz');
|
|
assert.equal(res.status, 200);
|
|
const body = await res.json();
|
|
assert.equal(body.ok, true);
|
|
assert.equal(body.service, 'solus');
|
|
});
|
|
|
|
test('GET /api/admin/status rejects with 401 without token (before DB init)', async () => {
|
|
delete process.env.ADMIN_TOKEN;
|
|
const res = await app.request('/api/admin/status');
|
|
assert.equal(res.status, 401);
|
|
});
|
|
});
|