feat: add pluggable search service registry
This commit is contained in:
@@ -165,6 +165,7 @@ test('admin system disclosure policy routes version config through the injected
|
||||
|
||||
test('admin MindSearch routes persist only through injected control-plane service', async () => {
|
||||
const updates = [];
|
||||
const testedServices = [];
|
||||
const router = createAdminApi({
|
||||
jsonBody: express.json(), getToken() { return 'token-admin'; },
|
||||
userAuth: { async getMe() { return { id: 'admin-1', role: 'admin' }; } },
|
||||
@@ -173,6 +174,7 @@ test('admin MindSearch routes persist only through injected control-plane servic
|
||||
async getAdminConfig() { return { config: { enabled: false, mode: 'off', providers: { searxng: false, github: false, reader: false } }, source: 'env' }; },
|
||||
async updateAdminConfig(patch, context) { updates.push({ patch, context }); return { config: { enabled: true, mode: 'shadow', providers: { searxng: true, github: false, reader: false } }, source: 'admin' }; },
|
||||
async getRuntimeState() { return { effective: false, mode: 'off' }; },
|
||||
async testService(serviceId) { testedServices.push(serviceId); return { ok: true, serviceId, latencyMs: 3 }; },
|
||||
},
|
||||
plazaPosts: null, plazaOps: null, wechatAdmin: null, subscriptionService: null,
|
||||
});
|
||||
@@ -185,6 +187,9 @@ test('admin MindSearch routes persist only through injected control-plane servic
|
||||
assert.deepEqual(updates, [{ patch: { enabled: true, mode: 'shadow' }, context: { updatedBy: 'admin-1' } }]);
|
||||
const runtime = await fetch(`${server.baseUrl}/admin-api/mindsearch/runtime`, { headers: { cookie: 'h5_user_session=token-admin' } });
|
||||
assert.deepEqual(await runtime.json(), { effective: false, mode: 'off' });
|
||||
const serviceTest = await fetch(`${server.baseUrl}/admin-api/mindsearch/services/searxng/test`, { method: 'POST', headers: { cookie: 'h5_user_session=token-admin' } });
|
||||
assert.deepEqual(await serviceTest.json(), { ok: true, serviceId: 'searxng', latencyMs: 3 });
|
||||
assert.deepEqual(testedServices, ['searxng']);
|
||||
} finally { await server.close(); }
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user