add basic functionality

This commit is contained in:
2017-01-29 20:50:36 +01:00
parent 7c7f2f8b90
commit 78b5412630
27 changed files with 210 additions and 160 deletions

View File

@@ -1,13 +1,27 @@
import 'typings-test'
import * as should from 'should'
import * as smartipc from '../dist/index'
let testIpcMaster: smartipc.IpcMaster
let testThreadFunction: smartipc.ThreadFunction
let testThread: smartipc.Thread
describe('smartipc',function(){
it('should create an instance of IpcMaster',function(){
testIpcMaster = new smartipc.IpcMaster({})
should(testIpcMaster).be.instanceof(smartipc.IpcMaster)
it('should create an instance of ThreadFunction',function(){
testThreadFunction = new smartipc.ThreadFunction((input, done) => {
let url = require('url')
done(url.parse(input))
})
testThreadFunction.send('https://google.com').then(message => {
console.log(message)
testThreadFunction.kill()
})
})
it('should create an instance of Thread',function(){
smartipc.setWorkerBasePath(__dirname)
testThread = new smartipc.Thread('child.js')
testThread.send('https://google.com').then(message => {
console.log(message)
testThread.kill()
})
})
})