1// Flags: --expose-internals 2'use strict'; 3const common = require('../common'); 4const assert = require('assert'); 5const StreamWrap = require('internal/js_stream_socket'); 6const { PassThrough } = require('stream'); 7const { Socket } = require('net'); 8 9{ 10 const wrap = new StreamWrap(new PassThrough()); 11 assert(wrap instanceof Socket); 12 wrap.on('data', common.mustCall((d) => assert.strictEqual(`${d}`, 'foo'))); 13 wrap.on('end', common.mustNotCall()); 14 wrap.write('foo'); 15} 16 17{ 18 const wrap = new StreamWrap(new PassThrough()); 19 assert(wrap instanceof Socket); 20 wrap.on('data', common.mustCall((d) => assert.strictEqual(`${d}`, 'foo'))); 21 wrap.on('end', common.mustCall()); 22 wrap.end('foo'); 23} 24