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.

27 lines
801 B

var sys = require('sys'),
colors = require('colors'),
xmpp = require('node-xmpp'),
Client = require('../lib/xmpp-client').Client,
conf = require('./conf').conf;
exports.testClient = function(test) {
test.expect(3);
var MESSAGE = "Beuha de test!";
var b = new Client(conf.b, function() {
this.addListener('message', function(stanza){
sys.debug('Message from ' + stanza.toString().red);
test.equals(MESSAGE, stanza.getChild('body').getText());
test.done();
});
sys.debug('b is connected'.red);
test.ok(true);
var a = new Client(conf.a, function(){
sys.debug('a is connected'.green);
sys.debug('a presences : ' + JSON.stringify(a.presences).green);
// test.equals('available', a.presences['' + b.jid]);
test.ok(true);
a.message(conf.b.jid, MESSAGE);
});
});
};