Fix POW test
This commit is contained in:
parent
667775f015
commit
663006a0e5
24
test.js
24
test.js
|
@ -327,14 +327,22 @@ 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 validNonces = typeof window === "undefined" ?
|
var initialHash = Buffer("8ff2d685db89a0af2e3dbfd3f700ae96ef4d9a1eac72fd778bbb368c7510cddda349e03207e1c4965bd95c6f7265e8f1a481a08afab3874eaafb9ade09a10880", "hex");
|
||||||
[21997550] :
|
return POW.doAsync({target: target, initialHash: initialHash})
|
||||||
[2373146, 2543600, 3593915];
|
.then(function(nonce) {
|
||||||
return POW.doAsync({target: target, initialHash: Buffer("8ff2d685db89a0af2e3dbfd3f700ae96ef4d9a1eac72fd778bbb368c7510cddda349e03207e1c4965bd95c6f7265e8f1a481a08afab3874eaafb9ade09a10880", "hex")})
|
// FIXME(Kagami): Chromium behaves very strangely on Travis CI:
|
||||||
.then(function(computedNonce) {
|
// computed nonces may vary in a big range (since target is
|
||||||
// Multiple valid nonces.
|
// simple, there are a lot of valid nonces). Probably because
|
||||||
expect(validNonces).to.include(computedNonce);
|
// some spawned web workers get blocked for some reason.
|
||||||
});
|
if (typeof window === "undefined") {
|
||||||
|
expect(nonce).to.equal(21997550);
|
||||||
|
}
|
||||||
|
expect(POW.check({
|
||||||
|
nonce: nonce,
|
||||||
|
target: target,
|
||||||
|
initialHash: initialHash,
|
||||||
|
})).to.be.true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user