Fix test again

This commit is contained in:
Kagami Hiiragi 2015-01-11 15:00:12 +03:00
parent e3765b81fc
commit b7f796e78b
3 changed files with 8 additions and 6 deletions

View File

@ -8,9 +8,9 @@
// `bitmessage -> eccrypto -> elliptic -> hash.js` so it won't add // `bitmessage -> eccrypto -> elliptic -> hash.js` so it won't add
// additional bytes to the bundle. // additional bytes to the bundle.
var hash = require("hash.js"); var hash = require("hash.js");
// Use only one submodule from `sha.js` here and in subworker because // Use only one submodule from `sha.js` here and in worker because it's
// it's faster. It will add additional bytes to the bundle but not that // faster. It will add additional bytes to the bundle but not that much
// much (~10-30KB). // (~9KB).
var Sha512 = require("sha.js/sha512"); var Sha512 = require("sha.js/sha512");
var BN = require("bn.js"); var BN = require("bn.js");
var work = require("webworkify"); var work = require("webworkify");

View File

@ -56,7 +56,7 @@
"hash.js": "^1.0.2", "hash.js": "^1.0.2",
"nan": "^1.4.1", "nan": "^1.4.1",
"object-assign": "^2.0.0", "object-assign": "^2.0.0",
"sha.js": "^2.3.0", "sha.js": "^2.3.1",
"webworkify": "^1.0.1" "webworkify": "^1.0.1"
} }
} }

View File

@ -283,11 +283,13 @@ describe("POW", function() {
it("should do a POW", function() { it("should do a POW", function() {
this.timeout(300000); this.timeout(300000);
var target = typeof window === "undefined" ? 297422593171 : 10693764680411; var target = typeof window === "undefined" ? 297422593171 : 10693764680411;
var nonces = typeof window === "undefined" ? [21997550] : [2373146, 2543600]; var validNonces = typeof window === "undefined" ?
[21997550] :
[2373146, 2543600, 3593915];
return POW.doAsync({target: target, initialHash: Buffer("8ff2d685db89a0af2e3dbfd3f700ae96ef4d9a1eac72fd778bbb368c7510cddda349e03207e1c4965bd95c6f7265e8f1a481a08afab3874eaafb9ade09a10880", "hex")}) return POW.doAsync({target: target, initialHash: Buffer("8ff2d685db89a0af2e3dbfd3f700ae96ef4d9a1eac72fd778bbb368c7510cddda349e03207e1c4965bd95c6f7265e8f1a481a08afab3874eaafb9ade09a10880", "hex")})
.then(function(computedNonce) { .then(function(computedNonce) {
// Multiple valid nonces. // Multiple valid nonces.
expect(nonces).to.include(computedNonce); expect(validNonces).to.include(computedNonce);
}); });
}); });
} }