|
|
@ -8,7 +8,6 @@ var sys = require('sys'),
|
|
|
|
exports.testInit = function(test) {
|
|
|
|
exports.testInit = function(test) {
|
|
|
|
test.expect(1);
|
|
|
|
test.expect(1);
|
|
|
|
var b = new BasicClient(conf.b, function() {
|
|
|
|
var b = new BasicClient(conf.b, function() {
|
|
|
|
sys.debug('just connected');
|
|
|
|
|
|
|
|
test.ok(true, 'connected');
|
|
|
|
test.ok(true, 'connected');
|
|
|
|
test.done();
|
|
|
|
test.done();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -19,9 +18,29 @@ exports.testIq = function(test) {
|
|
|
|
new BasicClient(conf.b, function() {
|
|
|
|
new BasicClient(conf.b, function() {
|
|
|
|
this.iq(null, new xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
|
|
|
|
this.iq(null, new xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
|
|
|
|
var roster = iq.getChild('query', 'jabber:iq:roster').getChildren('item');
|
|
|
|
var roster = iq.getChild('query', 'jabber:iq:roster').getChildren('item');
|
|
|
|
sys.debug(roster);
|
|
|
|
//sys.debug(roster);
|
|
|
|
test.notEqual(null, roster, 'roster');
|
|
|
|
test.notEqual(null, roster, 'roster');
|
|
|
|
test.done();
|
|
|
|
test.done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.testPresence = function(test) {
|
|
|
|
|
|
|
|
test.expect(1);
|
|
|
|
|
|
|
|
var b = new BasicClient(conf.b, function() {
|
|
|
|
|
|
|
|
this.addListener('presence', function(presence) {
|
|
|
|
|
|
|
|
//sys.debug(presence.attrs.from.split('/')[0].red);
|
|
|
|
|
|
|
|
if(presence.attrs.from.split('/')[0] == conf.a.jid) {
|
|
|
|
|
|
|
|
test.ok(true, "B is present");
|
|
|
|
|
|
|
|
test.done();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var a = new BasicClient(conf.a, function() {
|
|
|
|
|
|
|
|
this.addListener('presence', function(presence) {
|
|
|
|
|
|
|
|
//sys.debug(presence.toString().yellow);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
this.presence();
|
|
|
|
|
|
|
|
b.presence();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|