mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
Refresh Goal reads on plugin.updated, with recovery coverage
This commit is contained in:
1 parent
47066b33b2
commit
edd083e417
6 files changed
+295
-6
No files matched your search
@@ -118,6 +118,18 @@ describe('readSessionGoal', () => {
|
||||
await expect(readSessionGoal(createApi(call), { sessionID: SESSION_ID })).resolves.toEqual({ supported: false })
|
||||
})
|
||||
|
||||
it('reads the goal again after an unavailable rpc', async () => {
|
||||
const call = vi
|
||||
.fn<OpenCodeApi['rpc']['call']>()
|
||||
.mockRejectedValueOnce(rpcError('rpc.unavailable', 'RPC is unavailable: opencode.goal'))
|
||||
.mockResolvedValueOnce({ output: null })
|
||||
const api = createApi(call)
|
||||
|
||||
await expect(readSessionGoal(api, { sessionID: SESSION_ID })).resolves.toEqual({ supported: false })
|
||||
await expect(readSessionGoal(api, { sessionID: SESSION_ID })).resolves.toEqual({ supported: true, goal: null })
|
||||
expect(call).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('rethrows every other error unchanged', async () => {
|
||||
const error = rpcError('rpc.failed', 'boom')
|
||||
const call = vi.fn<OpenCodeApi['rpc']['call']>().mockRejectedValue(error)
|
||||
|
||||
Reference in new issue
Block a user