test(gateway): report a business rejection under an aborted carrier as cancelled

This commit is contained in:
imccyu
2026-08-11 23:33:17 +08:00
parent ea791827f4
commit 03f88e3c3d
@@ -1011,6 +1011,24 @@ describe('TypertGatewayService', () => {
error: { code: 'internal', message: 'non-error failure', details: {} }, error: { code: 'internal', message: 'non-error failure', details: {} },
}) })
// A business rejection observed while the carrier signal is already aborted
// is the caller's cancellation, not an internal gateway fault.
const cancelledCall = new AbortController()
cancelledCall.abort(new Error('client disconnected'))
service.businessError = new Error('fixture business failure')
await expect(handler(
'goals/fail',
{ args: { request: null } },
cancelledCall.signal,
)).resolves.toEqual({
ok: false,
error: {
code: 'cancelled',
message: 'Remote invocation "goals/fail" was aborted',
details: {},
},
})
await gatewayFiber.dispose() await gatewayFiber.dispose()
expect(connection.handler).toBeUndefined() expect(connection.handler).toBeUndefined()
}) })