fix(core): update

This commit is contained in:
2019-04-09 12:30:12 +02:00
parent cea7ea469c
commit fecda5e668
5 changed files with 68 additions and 21 deletions

View File

@ -4,24 +4,36 @@ import * as smartipc from '../ts/index';
import * as smartspawn from '@pushrocks/smartspawn';
import * as smartpromise from '@pushrocks/smartpromise';
let testIpc: smartipc.SmartIpc;
let serverIpc: smartipc.SmartIpc;
let clientIpc: smartipc.SmartIpc;
tap.test('should instantiate a valid instance', async () => {
testIpc = new smartipc.SmartIpc({
serverIpc = new smartipc.SmartIpc({
ipcSpace: 'testSmartIpc',
type: 'server'
});
testIpc.start();
serverIpc.registerHandler({
keyword: 'hi',
handlerFunc: data => {
console.log(data);
}
});
await serverIpc.start();
});
tap.test('should create a client', async tools => {
const clientIpc = new smartipc.SmartIpc({
clientIpc = new smartipc.SmartIpc({
ipcSpace: 'testSmartIpc',
type: 'client'
});
clientIpc.sendMessage();
await clientIpc.start();
clientIpc.sendMessage('hi', { awesome: 'yes' });
});
tap.test('should terminate the smartipc process', async () => {});
tap.test('should terminate the smartipc process', async (tools) => {
await tools.delayFor(1000);
await clientIpc.stop();
await serverIpc.stop();
});
tap.start();