test(tools): use type-safe error assertions instead of any casts

oxlint's no-unsafe-member-access rejects member access through an any
cast; the error info is reachable through the declared optional chain.
This commit is contained in:
Chinesezjc
2026-08-11 22:40:36 +08:00
parent 610dc74ea8
commit 47f108bf50
2 changed files with 3 additions and 6 deletions
+2 -4
View File
@@ -1573,8 +1573,7 @@ describe('the run_code dispatch bridge', () => {
arguments: { text: 'hello' },
})
expect(result.isError).toBe(true)
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- error is a union type
expect((result.error as any).info.code).toBe('UNKNOWN_TOOL')
expect(result.error?.info).toEqual({ name: 'ToolNotFoundError', code: 'UNKNOWN_TOOL' })
})
it('routes a pre-aborted collapsed call through ABORTED_BEFORE_DISPATCH', async () => {
@@ -1591,8 +1590,7 @@ describe('the run_code dispatch bridge', () => {
arguments: { text: 'hello' },
})
expect(result.isError).toBe(true)
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- error is a union type
expect((result.error as any).info.code).toBe(TOOL_ABORTED_BEFORE_DISPATCH)
expect(result.error?.info?.code).toBe(TOOL_ABORTED_BEFORE_DISPATCH)
})
})