1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

14 years ago
var sys = require('sys'),
colors = require('colors'),
xmpp = require('node-xmpp'),
BasicClient = require('../lib/xmpp-client').BasicClient,
JID = require('node-xmpp').JID,
conf = require('./conf').conf;
exports.testInit = function(test) {
test.expect(1);
var b = new BasicClient(conf.b, function() {
14 years ago
test.ok(true, 'connected');
14 years ago
test.done();
});
14 years ago
};
exports.testIq = function(test) {
test.expect(1);
new BasicClient(conf.b, function() {
this.iq(null, new xmpp.Element('query', {xmlns: 'jabber:iq:roster'}), function(iq) {
var roster = iq.getChild('query', 'jabber:iq:roster').getChildren('item');
14 years ago
//sys.debug(roster);
14 years ago
test.notEqual(null, roster, 'roster');
test.done();
});
});
14 years ago
};
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();
});
});
14 years ago
};