Files
Jarvise-project/backend/test/health.test.js
T
BlackAngelTV 877df963f9 test(backend): cover auth, projects and streaming with a mocked Ollama
Tests run without any external service; the mock streams NDJSON chunks so the
SSE path is exercised end to end.
2026-10-05 15:01:57 +02:00

32 lines
858 B
JavaScript

import assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import { api, startServer } from './helpers.js';
describe('health', () => {
let srv;
before(async () => {
srv = await startServer();
});
after(async () => {
await srv.close();
});
it('reports ok with the database and Ollama status', async () => {
const res = await api(srv.base, 'GET', '/health');
assert.equal(res.status, 200);
assert.equal(res.json.status, 'ok');
assert.equal(res.json.database, 'ok');
assert.equal(res.json.ollama.reachable, true);
assert.ok(res.json.ollama.models.includes('mock:1'));
});
it('returns a JSON 404 for an unknown route', async () => {
const res = await api(srv.base, 'GET', '/api/unknown');
assert.equal(res.status, 404);
assert.ok(res.json.error);
});
});