fix(core): update
This commit is contained in:
24
test/test.ts
24
test/test.ts
@ -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();
|
||||
|
Reference in New Issue
Block a user