11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst StreamWrap = require('internal/js_stream_socket'); 61cb0ef41Sopenharmony_ciconst { PassThrough } = require('stream'); 71cb0ef41Sopenharmony_ciconst { Socket } = require('net'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci{ 101cb0ef41Sopenharmony_ci const wrap = new StreamWrap(new PassThrough()); 111cb0ef41Sopenharmony_ci assert(wrap instanceof Socket); 121cb0ef41Sopenharmony_ci wrap.on('data', common.mustCall((d) => assert.strictEqual(`${d}`, 'foo'))); 131cb0ef41Sopenharmony_ci wrap.on('end', common.mustNotCall()); 141cb0ef41Sopenharmony_ci wrap.write('foo'); 151cb0ef41Sopenharmony_ci} 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci{ 181cb0ef41Sopenharmony_ci const wrap = new StreamWrap(new PassThrough()); 191cb0ef41Sopenharmony_ci assert(wrap instanceof Socket); 201cb0ef41Sopenharmony_ci wrap.on('data', common.mustCall((d) => assert.strictEqual(`${d}`, 'foo'))); 211cb0ef41Sopenharmony_ci wrap.on('end', common.mustCall()); 221cb0ef41Sopenharmony_ci wrap.end('foo'); 231cb0ef41Sopenharmony_ci} 24