This commit is contained in:
Oleg Maslov
2026-09-02 10:14:22 +02:00
parent 0c3e2ead3b
commit b20b138fe4
771 changed files with 161561 additions and 9027 deletions

View File

@@ -1,4 +1,4 @@
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
@@ -16,7 +16,11 @@ describe('Health Endpoint', () => {
const mind = new MindDB(personalPath);
mind.close();
server = await buildLocalServer({ dataDir: tmpDir });
server = await buildLocalServer({
dataDir: tmpDir,
port: 38123,
instanceId: 'desktop-instance-test',
});
});
afterAll(async () => {
@@ -44,6 +48,20 @@ describe('Health Endpoint', () => {
expect(body.database.healthy).toBe(true);
});
it('reports the desktop launch identity used for sidecar ownership checks', async () => {
vi.stubEnv('WAGGLE_INSTANCE_ID', 'mutated-after-launch');
try {
const res = await server.inject({ method: 'GET', url: '/health' });
expect(res.statusCode).toBe(200);
expect(JSON.parse(res.payload)).toMatchObject({
instanceId: 'desktop-instance-test',
port: 38123,
});
} finally {
vi.unstubAllEnvs();
}
});
it('overall status reflects LLM health', async () => {
// Default: llmProvider was set to unavailable (no init via startService)
const res = await server.inject({ method: 'GET', url: '/health' });