// Copyright (c) 2024 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 import { strictEqual } from 'assert'; export const abortInternalStreamsTest = { async test() { const { writable } = new IdentityTransformStream(); const writer = writable.getWriter(); const promise = writer.write(new Uint8Array(10)); await writer.abort(); // The write promise should abort proactively without waiting for a read, // indicating that the queue was drained proactively when the abort was // called. try { await promise; throw new Error('The promise should have been rejected'); } catch (err) { strictEqual(err, undefined); } }, };