11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cirequire('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst { addAbortSignal, Readable } = require('stream'); 71cb0ef41Sopenharmony_ciconst { 81cb0ef41Sopenharmony_ci addAbortSignalNoValidate, 91cb0ef41Sopenharmony_ci} = require('internal/streams/add-abort-signal'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci{ 121cb0ef41Sopenharmony_ci assert.throws(() => { 131cb0ef41Sopenharmony_ci addAbortSignal('INVALID_SIGNAL'); 141cb0ef41Sopenharmony_ci }, /ERR_INVALID_ARG_TYPE/); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci const ac = new AbortController(); 171cb0ef41Sopenharmony_ci assert.throws(() => { 181cb0ef41Sopenharmony_ci addAbortSignal(ac.signal, 'INVALID_STREAM'); 191cb0ef41Sopenharmony_ci }, /ERR_INVALID_ARG_TYPE/); 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci{ 231cb0ef41Sopenharmony_ci const r = new Readable({ 241cb0ef41Sopenharmony_ci read: () => {}, 251cb0ef41Sopenharmony_ci }); 261cb0ef41Sopenharmony_ci assert.deepStrictEqual(r, addAbortSignalNoValidate('INVALID_SIGNAL', r)); 271cb0ef41Sopenharmony_ci} 28