node-ipc/test/oldTest/Unix/unixSocketServer.spec.js

47 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-01-10 23:32:46 +11:00
/*global describe, expect, it*/
2016-01-10 20:03:05 +11:00
'use strict';
const ipc = require('../../../../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;
2016-01-10 20:03:05 +11:00
ipc.config.maxConnections=1;
ipc.serve(
'/tmp/app.testWorld',
2016-01-10 20:03:05 +11:00
function serverStarted(){
ipc.server.on(
'connect',
2016-01-10 23:57:08 +11:00
function connected(){
2016-01-10 20:03:05 +11:00
clientCounter++;
}
);
}
);
setTimeout(
2016-01-10 23:57:08 +11:00
function clientCountDelay(){
expect(clientCounter).toBe(ipc.config.maxConnections);
ipc.server.stop();
done();
},
ipc.config.retry+ipc.config.retry
);
2016-01-10 20:03:05 +11:00
ipc.server.start();
}
);
}
);