Test fixes

This commit is contained in:
Kagami Hiiragi 2015-02-06 21:10:50 +03:00
parent 8406b46a47
commit 254fd196bf
3 changed files with 10 additions and 10 deletions

View File

@ -27,6 +27,7 @@ if (!process.browser) {
});
it("should resolve DNS seeds on bootstrap", function() {
this.timeout(10000);
var tcp2 = new TcpTransport({
dnsSeeds: [["bootstrap8444.bitmessage.org", 8444]],
});
@ -37,6 +38,7 @@ if (!process.browser) {
});
it("should return hardcoded seeds on bootstrap", function() {
this.timeout(10000);
var tcp3 = new TcpTransport({
seeds: [["1.1.1.1", 8080]],
dnsSeeds: [["bootstrap8444.bitmessage.org", 8444]],

View File

@ -6,16 +6,13 @@
var path = require("path");
var child = require("child_process");
var TCP_NODE_PATH = path.join(__dirname, "tcp-node.js");
var WS_NODE_PATH = path.join(__dirname, "ws-node.js");
function spawn(path) {
var p = child.spawn("node", [path]);
function spawn(name) {
var p = child.spawn("node", [path.join(__dirname, name)]);
p.stdout.on("data", function(data) {
console.log("Info from", path, ":", data.toString().trim());
console.log("Info from " + name + ": " + data.toString().trim());
});
p.stderr.on("data", function(err) {
console.log("Error from", path, ":", err.toString());
console.log("Error from " + name + ": " + err.toString().trim());
});
return p;
}
@ -38,9 +35,10 @@ module.exports = function() {
};
}
var tcpNode = spawn(TCP_NODE_PATH);
var wsNode = spawn(WS_NODE_PATH);
process.on("exit", cleanup());
process.on("SIGINT", cleanup(true));
process.on("uncaughtException", cleanup(true));
var tcpNode = spawn("tcp-node.js");
var wsNode = spawn("ws-node.js");
};

View File

@ -383,7 +383,7 @@ describe("Common structures", function() {
expect(net_addr.decode(encoded).host).to.equal("127.0.0.1");
});
it("should encode bad IPv4", function() {
it("shouldn't encode bad IPv4", function() {
var opts = {host: " 127.0.0.1", port: 1234};
expect(net_addr.encode.bind(null, opts)).to.throw(/bad octet/i);
});