mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 23:34:26 +00:00
c66ae7b2e4
Launch an Xspice and run: echo -ne "\033]844;127.0.0.1;9876\007" This will launch a SPiCE client connecting to 127.0.0.1:9876. Still need to add all the security stuff and generally be more defensive in the implementation.
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
suite('ConnectionControl', function() {
|
|
var sut, socket, config;
|
|
|
|
setup(function() {
|
|
config = {
|
|
'heartbeatTimeout': 4000,
|
|
'protocol': 'ws',
|
|
'host': 'localhost',
|
|
'port': 8000,
|
|
'busHost': 'localhost',
|
|
'heartbeatToken': 'heartbeat'
|
|
};
|
|
socket = {
|
|
connect: function() {},
|
|
setOnMessageCallback: function() {},
|
|
disconnect: function() {}
|
|
};
|
|
sut = new wdi.ConnectionControl({socket: socket});
|
|
});
|
|
|
|
test('connect should call socket connect with uri', function() {
|
|
var expectedString = config['protocol'] + '://' + config['host'] + ':' + config['port'] +
|
|
'/websockify/destInfoToken/' + config['heartbeatToken']+'/type/raw';
|
|
var mock = sinon.mock(socket);
|
|
var expectation = mock.expects('connect').once().withArgs(expectedString);
|
|
sut.connect(config);
|
|
expectation.verify();
|
|
});
|
|
|
|
test('connect should call socket setOnMessageCallback with callback', function() {
|
|
var mock = sinon.mock(socket);
|
|
var expectation = mock.expects('setOnMessageCallback').once().withArgs(sinon.match.func);
|
|
sut.connect(config);
|
|
expectation.verify();
|
|
});
|
|
|
|
test('disconnect should call socket disconnect', function() {
|
|
var mock = sinon.mock(socket);
|
|
var expectation = mock.expects('disconnect').once().withArgs();
|
|
sut.disconnect();
|
|
expectation.verify();
|
|
});
|
|
});
|