From 33c0fa3746664cc6cf6663aa4a9dc8a38cf692fa Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 13 Aug 2019 09:37:23 +0200 Subject: [PATCH] fix(core): update --- test/test.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/test.ts b/test/test.ts index 69fc3e9..27a32f7 100644 --- a/test/test.ts +++ b/test/test.ts @@ -10,7 +10,8 @@ import smartsocket = require('../ts/index'); let testSmartsocket: smartsocket.Smartsocket; let testSmartsocketClient: smartsocket.SmartsocketClient; let testSocketRole1: smartsocket.SocketRole; -let testSocketFunction1: smartsocket.SocketFunction; +let testSocketFunctionServer: smartsocket.SocketFunction; +let testSocketFunctionClient: smartsocket.SocketFunction; const testConfig = { port: 3000 @@ -33,14 +34,23 @@ tap.test('should add a socketrole', async () => { // class SocketFunction tap.test('should register a new Function', async () => { - testSocketFunction1 = new smartsocket.SocketFunction({ + testSocketFunctionServer = new smartsocket.SocketFunction({ allowedRoles: [testSocketRole1], funcDef: async (dataArg, socketConnectionArg) => { return dataArg; }, funcName: 'testFunction1' }); - testSmartsocket.addSocketFunction(testSocketFunction1); + testSmartsocket.addSocketFunction(testSocketFunctionServer); + + testSocketFunctionClient = new smartsocket.SocketFunction({ + allowedRoles: [], + funcDef: async (dataArg, socketConnectionArg) => { + return dataArg; + }, + funcName: 'testFunction1' + }); + testSmartsocket.addSocketFunction(testSocketFunctionServer); console.log(testSmartsocket.socketFunctions); }); @@ -57,7 +67,7 @@ tap.test('should react to a new websocket connection from client', async () => { alias: 'testClient1', role: 'testRole1' }); - testSmartsocketClient.addSocketFunction(testSocketFunction1); + testSmartsocketClient.addSocketFunction(testSocketFunctionClient); console.log(testSmartsocketClient.socketFunctions); await testSmartsocketClient.connect(); });