1'use strict'; 2const common = require('../common'); 3const assert = require('assert'); 4 5const { OutgoingMessage } = require('http'); 6 7{ 8 // Tests for settimeout method with socket 9 const expectedMsecs = 42; 10 const outgoingMessage = new OutgoingMessage(); 11 outgoingMessage.socket = { 12 setTimeout: common.mustCall((msecs) => { 13 assert.strictEqual(msecs, expectedMsecs); 14 }) 15 }; 16 outgoingMessage.setTimeout(expectedMsecs); 17} 18 19{ 20 // Tests for settimeout method without socket 21 const expectedMsecs = 23; 22 const outgoingMessage = new OutgoingMessage(); 23 outgoingMessage.setTimeout(expectedMsecs); 24 25 outgoingMessage.emit('socket', { 26 setTimeout: common.mustCall((msecs) => { 27 assert.strictEqual(msecs, expectedMsecs); 28 }) 29 }); 30} 31