This repository was archived by the owner on Nov 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathtest-frame.js
65 lines (63 loc) · 1.7 KB
/
test-frame.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var stomp = require("stomp");
var testCase = require("nodeunit/nodeunit").testCase;
module.exports['initialize'] = testCase({
setUp: function (callback) {
var stomp_args = {
port: 61613,
host: 'localhost',
debug: false,
login: 'guest',
passcode: 'guest',
};
this.client = new stomp.Stomp(stomp_args);
callback();
},
tearDown: function (callback) {
callback();
},
'port is 61613': function(test) {
test.equal(this.client.port, 61613);
test.done();
},
'host is localhost': function(test) {
test.equal(this.client.host, 'localhost');
test.done();
},
'debug is false': function(test) {
test.equal(this.client.debug, false);
test.done();
},
'login is guest': function(test) {
test.equal(this.client.login, 'guest');
test.done();
},
'passcode is guest': function(test) {
test.equal(this.client.passcode, 'guest');
test.done();
}
});
module.exports['connect'] = testCase({
setUp: function (callback) {
var stomp_args = {
port: 61613,
host: 'localhost',
debug: false,
login: 'guest',
passcode: 'guest',
};
this.client = new stomp.Stomp(stomp_args);
this._connect = this.client.connect;
this.client.connect = function() {
return true;
};
callback();
},
tearDown: function (callback) {
this.client.connect = this._connect;
callback();
},
'should call connect': function(test) {
test.ok(this.client.connect());
test.done();
}
});