Import packages/plugin/tests/plugin-route-client.test.ts

This commit is contained in:
QQ 2026-11-17 08:51:10 +08:00
parent e8bee21b60
commit 0b745f9ec6
1 changed files with 13 additions and 0 deletions

View File

@ -206,6 +206,19 @@ describe('browser plugin route authority', () => {
], cleanup)
})
it('returns an empty roster while the Host has no Bot route and discovers it when enabled', async () => {
const host = await carrier()
host.routeStatus = 404
for (let poll = 0; poll < 3; poll++) {
const response = await host.fetch('api/bot', { method: 'POST', body: JSON.stringify({ endpoint: 'state' }) })
expect(await response.json()).toEqual({ ok: true, value: { bots: [], rooms: [], agents: [] } })
}
expect(host.local).not.toHaveBeenCalled()
host.routeStatus = 200
const response = await host.fetch('api/bot', { method: 'POST', body: JSON.stringify({ endpoint: 'state' }) })
expect(await response.json()).toEqual({ ok: true, value: { source: 'remote' } })
})
it('reports Host route and control refusals in the DS Bot error envelope without exposing upstream data', async () => {
await runScenarios([
{ name: 'missing ds-bot route', status: 404, code: 'remote-plugin/bot-not-loaded' },