test: cover the agent-preset wire routes and both restore edges

master moved the RPC surface onto the fetch transport, so the two agentPreset
methods arrived there with nothing driving them. Adds the round trip, plus the
two `recompose` edges that had none: an agent that never composed a preset, so
there is nothing to restore, and a restore that fails because the composition
it reaches for is gone — the roster is a live directory.

Marks the deliberate non-Error rejections in the store specs, which is the
branch they exist to cover.
This commit is contained in:
Yichen Jiang
2026-08-07 16:39:44 +08:00
parent d13cb724ee
commit e265c6038f
3 changed files with 64 additions and 1 deletions

View File

@@ -169,6 +169,7 @@ describe('the agent-preset settings controller', () => {
describe: () => Promise.resolve({
rpcId: 'r', result: { ok: true as const, value: { writable: true, hasDocument: true, namespaces: [] } },
}),
// oxlint-disable-next-line typescript/prefer-promise-reject-errors -- the non-Error branch is what this covers
update: () => Promise.reject(value),
},
} as unknown as IApiClient)
@@ -181,6 +182,7 @@ describe('the agent-preset settings controller', () => {
expect(controller.store.getSnapshot().error).toBe('socket closed')
const failing = new AgentPresetSettingsController({
// oxlint-disable-next-line typescript/prefer-promise-reject-errors -- the non-Error branch is what this covers
agentPresets: { list: () => Promise.reject('offline') },
settings: {
describe: () => Promise.resolve({
@@ -368,7 +370,9 @@ describe('the composer seat controller', () => {
it('reads a rejection that is not an Error', async () => {
const api = {
agentPresets: {
// oxlint-disable-next-line typescript/prefer-promise-reject-errors -- the non-Error branch is what this covers
list: () => Promise.reject('offline'),
// oxlint-disable-next-line typescript/prefer-promise-reject-errors -- the non-Error branch is what this covers
select: () => Promise.reject('socket closed'),
},
} as unknown as IApiClient