smartsocket/test/test.ts

36 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-08-07 12:58:20 +00:00
import "typings-test";
import "should";
import socketIoClient = require("socket.io-client");
import smartsocket = require("../dist/index");
let testSmartsocket: smartsocket.Smartsocket;
let testSmartsocketClient: smartsocket.SmartsocketClient;
let testConfig = {
port:3000
}
2016-08-07 12:58:20 +00:00
describe("smartsocket", function () {
it("should create a new smartsocket", function () {
testSmartsocket = new smartsocket.Smartsocket({ port: testConfig.port });
2016-08-07 12:58:20 +00:00
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
});
it("should register a new Function", function () {
2016-08-07 16:59:39 +00:00
})
it("should start listening when .started is called", function () {
2016-08-07 16:59:39 +00:00
testSmartsocket.startServer();
})
2016-08-07 12:58:20 +00:00
it("should react to a new websocket connection", function (done) {
this.timeout(10000);
testSmartsocketClient = new smartsocket.SmartsocketClient({
port: testConfig.port,
url: "http://localhost",
password:"testPassword",
alias: "testClient1"
2016-08-07 12:58:20 +00:00
});
2016-08-07 16:59:39 +00:00
});
it("should close the server", function () {
2016-08-07 16:59:39 +00:00
testSmartsocket.closeServer();
});
2016-08-07 12:58:20 +00:00
});