node/test/parallel/test-net-server-listen-path.js
Sebastiaan Deckers bb29405904
lib,src: fix consistent spacing inside braces
PR-URL: https://github.com/nodejs/node/pull/14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-21 15:13:47 -04:00

50 lines
909 B
JavaScript

'use strict';
const common = require('../common');
const net = require('net');
common.refreshTmpDir();
function closeServer() {
return common.mustCall(function() {
this.close();
});
}
let counter = 0;
// Avoid conflict with listen-handle
function randomPipePath() {
return `${common.PIPE}-listen-path-${counter++}`;
}
// Test listen(path)
{
const handlePath = randomPipePath();
net.createServer()
.listen(handlePath)
.on('listening', closeServer());
}
// Test listen({path})
{
const handlePath = randomPipePath();
net.createServer()
.listen({ path: handlePath })
.on('listening', closeServer());
}
// Test listen(path, cb)
{
const handlePath = randomPipePath();
net.createServer()
.listen(handlePath, closeServer());
}
// Test listen(path, cb)
{
const handlePath = randomPipePath();
net.createServer()
.listen({ path: handlePath }, closeServer());
}