node-ipc/test/Unix/unixSocketServer.spec.js
2021-07-02 14:35:02 -07:00

45 lines
1.3 KiB
JavaScript

/*global describe, expect, it*/
const ipc = from '../../node-ipc');
describe(
'Test Cases for server: ',
function testDescribe(){
// Unix server verification //
it(
'Verify unix server detects only 1 client out of 2 clients and receives message.',
function testIt(done){
ipc.config.id ='testWorld';
ipc.config.retry = 1000;
ipc.config.silent=false;
let clientCounter=0;
ipc.config.maxConnections=1;
ipc.serve(
'/tmp/app.testWorld',
function serverStarted(){
ipc.server.on(
'connect',
function connected(){
clientCounter++;
}
);
}
);
setTimeout(
function clientCountDelay(){
expect(clientCounter).toBe(ipc.config.maxConnections);
ipc.server.stop();
done();
},
ipc.config.retry+ipc.config.retry
);
ipc.server.start();
}
);
}
);