test(apiproxy): round-trip every agent-preset method through the carrier

The domain's five registrations were unexercised on both halves of the
carrier, so a method missing from `handler.ts` or `client.ts` would have
surfaced in the browser rather than here. `read`/`write`/`remove` widened
the gap; this closes it for the whole domain.
This commit is contained in:
Yichen Jiang
2026-08-04 12:35:27 +08:00
parent 6dfc568ec2
commit 3a60d97d21

View File

@@ -359,6 +359,26 @@ describe('unary round trip (handler ⇄ client, no network)', () => {
expect((await c.host.describe({})).result.ok).toBe(true)
})
it('round-trips every agent-preset method, authoring included', async () => {
const c = client()
// The whole domain crosses the carrier: the roster a picker reads, the
// per-session switch, and the three authoring calls the settings editor
// makes. Each has its own request schema, so a registration missing from
// either half fails here rather than in the browser.
expect((await c.agentPresets.list({})).result).toEqual({
ok: true, value: { presets: [], authorable: false },
})
expect((await c.agentPresets.select({ sessionId: 's' as never, agentPreset: 'core-web' })).result)
.toEqual({ ok: true, value: { agentPreset: 'core-web' } })
expect((await c.agentPresets.read({ agentPreset: 'mine' })).result).toEqual({
ok: true, value: { agentPreset: 'mine', trust: 'user', content: '', writable: true },
})
expect((await c.agentPresets.write({ agentPreset: 'mine', content: '- id: x\n' })).result)
.toEqual({ ok: true, value: { agentPreset: 'mine' } })
expect((await c.agentPresets.remove({ agentPreset: 'mine' })).result).toEqual({ ok: true, value: {} })
})
it('round-trips the native picker without the default unary timeout', async () => {
const api = fakeApi()
api.host.pickDirectory = async (request) => {