1
0
Fork 0

try to connect

master
Matthieu Lalonde 15 years ago committed by Mathieu Lecarme
parent 01896a7db2
commit f48d119ceb

@ -1,26 +1,38 @@
var sys = require('sys'), var sys = require('sys'),
Client = require('../lib/xmpp-client').Client, Client = require('../lib/xmpp-client').Client,
Jid = require('../lib/xmpp-client').Jid; Jid = require('../lib/xmpp-client').Jid,
conf = require('./conf').conf;
exports.testJid = function(test) { exports.testJid = function(test) {
test.expect(4);
var j = new Jid('mathieu@gtalk.com'); var j = new Jid('mathieu@gtalk.com');
//sys.debug(JSON.stringify(j)); //sys.debug(JSON.stringify(j));
test.equals('mathieu', j.node); test.equals('mathieu', j.node);
test.equals('gtalk.com', j.domain); test.equals('gtalk.com', j.domain);
test.equals(null, j.resource);
j = new Jid('mathieu@jabber.org/node');
//sys.debug(JSON.stringify(j));
test.equals('node', j.resource); test.equals('node', j.resource);
j = new Jid('mathieu@jabber.org/machin');
//sys.debug(JSON.stringify(j));
test.equals('machin', j.resource);
test.done(); test.done();
}; };
exports.testClient = function(test) { exports.testClientInit = function(test) {
var c = new Client('mathieu@gtalk.com', 'toto'); var c = new Client('mathieu@gtalk.com', 'toto');
test.equals('gtalk.com', c.host); test.equals('gtalk.com', c.host);
test.done(); test.done();
}; };
if(module.id == '.'){ exports.testClient = function(test) {
test.expect(1);
var c = new Client(conf.jid, conf.password);
c.debug = true;
c.addListener('online', function() {
test.ok(true);
test.done();
});
};
if(module.id == '.') {
var testrunner = require('nodeunit').testrunner; var testrunner = require('nodeunit').testrunner;
testrunner.run([__filename]); testrunner.run([__filename]);
} }
Loading…
Cancel
Save