test(api): cover the non-Error terminal escape in RemoteStream
The terminal fold's String(error) arm had no coverage; a generation that rejects with a bare string now pins the marked gateway/internal outcome.
This commit is contained in:
1 parent
2f2e6d627b
commit
41cd24f3f6
1 file changed
+18
@@ -118,6 +118,24 @@ describe('RemoteStream', () => {
|
||||
expect(carrierFailed).toHaveBeenNthCalledWith(2, repeated)
|
||||
})
|
||||
|
||||
it('folds a non-Error terminal escape into a marked gateway/internal failure', async () => {
|
||||
const stream = new RemoteStream(hostSource(true).connection, {
|
||||
name: 'fixture stream',
|
||||
open: () => ({
|
||||
[Symbol.asyncIterator]: (): AsyncIterator<string> => ({
|
||||
next: vi.fn<() => Promise<IteratorResult<string>>>().mockRejectedValue('generation exploded'),
|
||||
}),
|
||||
}),
|
||||
ended: () => new Error('fixture stream ended'),
|
||||
})
|
||||
|
||||
await expect(stream[Symbol.asyncIterator]().next()).rejects.toMatchObject({
|
||||
isDSHRemoteGatewayError: true,
|
||||
code: 'gateway/internal',
|
||||
message: 'generation exploded',
|
||||
})
|
||||
})
|
||||
|
||||
it('passes a marked Remote failure through the terminal boundary verbatim', async () => {
|
||||
const failure = new RemoteError('gateway/internal', 'host stream failed', {})
|
||||
const stream = supervisor(hostSource(true).connection, [{ terminal: failure }])
|
||||
|
||||
Reference in new issue
Block a user