fix: 终审修复——health 断言精确化、config 注释修正

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
lovefyf
2026-08-13 02:44:01 +08:00
co-authored by Claude Fable 5
parent 86a8b24b60
commit 053e6224ee
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ export const config = {
url: process.env.KEYCLOAK_URL ?? 'https://keycloak.akhr-ai.com', url: process.env.KEYCLOAK_URL ?? 'https://keycloak.akhr-ai.com',
realm: process.env.KEYCLOAK_REALM ?? 'corp', realm: process.env.KEYCLOAK_REALM ?? 'corp',
clientId: process.env.KEYCLOAK_CLIENT_ID ?? 'api-gateway', clientId: process.env.KEYCLOAK_CLIENT_ID ?? 'api-gateway',
clientSecret: process.env.KEYCLOAK_CLIENT_SECRET, // 只从环境读,无缺省;data-service 恒无 clientSecret: process.env.KEYCLOAK_CLIENT_SECRET, // 只从环境读,无缺省
}, },
agentServiceUrl: process.env.AGENT_SERVICE_URL ?? 'http://127.0.0.1:8901', agentServiceUrl: process.env.AGENT_SERVICE_URL ?? 'http://127.0.0.1:8901',
taskServiceUrl: process.env.TASK_SERVICE_URL ?? 'http://127.0.0.1:8801', taskServiceUrl: process.env.TASK_SERVICE_URL ?? 'http://127.0.0.1:8801',
+4 -1
View File
@@ -6,6 +6,7 @@ vi.mock('../../src/shared/bus/nats', () => ({
})); }));
import { buildApp } from '../../src/app/app'; import { buildApp } from '../../src/app/app';
import { config } from '../../src/shared/config';
describe('health', () => { describe('health', () => {
it('nats 探活 ok(mock)时返回 200', async () => { it('nats 探活 ok(mock)时返回 200', async () => {
@@ -17,7 +18,9 @@ describe('health', () => {
checks: Record<string, string>; checks: Record<string, string>;
}; };
expect(body.ok).toBe(true); expect(body.ok).toBe(true);
expect(body.service).toMatch(/^bpos-service-/); expect(body.service).toBe('bpos-service-gateway');
expect(config.port).toBe(8800);
expect(config.keycloak.clientId).toBe('api-gateway');
expect(body.checks['nats']).toBe('ok'); expect(body.checks['nats']).toBe('ok');
}); });
}); });