update tests

This commit is contained in:
Philipp Kunz 2016-08-12 05:57:32 +02:00
parent ab2196fd5f
commit 8dfc39be75

View File

@ -1,12 +1,15 @@
"use strict";
require("typings-test");
require("should");
const socketIoClient = require("socket.io-client");
const smartsocket = require("../dist/index");
let testSmartsocket;
let testSmartsocketClient;
let testConfig = {
port: 3000
};
describe("smartsocket", function () {
it("should create a new smartsocket", function () {
testSmartsocket = new smartsocket.Smartsocket({ port: 3000 });
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
});
it("should register a new Function", function () {
@ -16,22 +19,15 @@ describe("smartsocket", function () {
});
it("should react to a new websocket connection", function (done) {
this.timeout(10000);
let socket = socketIoClient("http://localhost:3000", {});
socket.on("requestAuth", function () {
console.log("server requested authentication");
socket.emit("dataAuth", {
role: "coreflowContainer",
password: "somePassword",
alias: "coreflow1"
});
socket.on("authenticated", () => {
console.log("client is authenticated");
done();
});
testSmartsocketClient = new smartsocket.SmartsocketClient({
port: testConfig.port,
url: "http://localhost",
password: "testPassword",
alias: "testClient1"
});
});
it("should close the server", function () {
testSmartsocket.closeServer();
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQixNQUFPLGNBQWMsV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBQ3BELE1BQU8sV0FBVyxXQUFXLGVBQWUsQ0FBQyxDQUFDO0FBRTlDLElBQUksZUFBd0MsQ0FBQztBQUU3QyxRQUFRLENBQUMsYUFBYSxFQUFFO0lBQ3BCLEVBQUUsQ0FBQyxpQ0FBaUMsRUFBRTtRQUNsQyxlQUFlLEdBQUc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