feat(health): expose external in /services payload and accept on add/edit
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,18 @@ describe('health api (DB-backed registry)', () => {
|
||||
expect(infra.services.find(s => s.id === 'gitea').status).toBe('ok');
|
||||
});
|
||||
|
||||
it('GET /services includes external on every tile; POST round-trips it', async () => {
|
||||
const res = await request(app).get('/api/health/services').set(ownerHeaders);
|
||||
const all = res.body.flatMap(g => g.services);
|
||||
expect(all.every(s => 'external' in s)).toBe(true); // key present (may be null)
|
||||
expect(all.find(s => s.id === 'gitea').external).toBeNull(); // no domain set
|
||||
await request(app).post('/api/health/services').set(ownerHeaders)
|
||||
.send({ id: 'gramps', name: 'Gramps', category: 'infrastructure', url: 'http://192.168.1.99', external: 'https://gramps.hynesy.com' });
|
||||
const res2 = await request(app).get('/api/health/services').set(ownerHeaders);
|
||||
const gramps = res2.body.flatMap(g => g.services).find(s => s.id === 'gramps');
|
||||
expect(gramps.external).toBe('https://gramps.hynesy.com');
|
||||
});
|
||||
|
||||
it('POST /services adds a service that shows up in the band', async () => {
|
||||
const create = await request(app).post('/api/health/services').set(ownerHeaders)
|
||||
.send({ id: 'ollama', name: 'Ollama', category: 'agents', host: 'ct102', url: 'http://192.168.1.185:11434' });
|
||||
|
||||
Reference in New Issue
Block a user