45 lines
3.1 KiB
JavaScript
45 lines
3.1 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
require("should");
|
|
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: testConfig.port });
|
|
testSmartsocket.should.be.instanceOf(smartsocket.Smartsocket);
|
|
});
|
|
it("should register a new Function", function () {
|
|
});
|
|
it("should start listening when .started is called", function () {
|
|
testSmartsocket.startServer();
|
|
});
|
|
it("should react to a new websocket connection from client", function (done) {
|
|
this.timeout(10000);
|
|
testSmartsocketClient = new smartsocket.SmartsocketClient({
|
|
port: testConfig.port,
|
|
url: "http://localhost",
|
|
password: "testPassword",
|
|
alias: "testClient1"
|
|
});
|
|
testSmartsocketClient.connect()
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
it("client should disconnect and reconnect", function (done) {
|
|
this.timeout(10000);
|
|
testSmartsocketClient.disconnect()
|
|
.then(testSmartsocketClient.connect)
|
|
.then(() => {
|
|
done();
|
|
});
|
|
});
|
|
it("should close the server", function () {
|
|
testSmartsocket.closeServer();
|
|
});
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUVoQixNQUFPLFdBQVcsV0FBVyxlQUFlLENBQUMsQ0FBQztBQUU5QyxJQUFJLGVBQXdDLENBQUM7QUFDN0MsSUFBSSxxQkFBb0QsQ0FBQztBQUV6RCxJQUFJLFVBQVUsR0FBRztJQUNiLElBQUksRUFBQyxJQUFJO0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