Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

break up BIP39 tests so the individual ones run faster #461

Merged
merged 2 commits into from
Jul 25, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 19 additions & 12 deletions test/test.BIP39.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,27 @@ describe('BIP39', function() {
it('should generate a mnemonic phrase', function() {
var phrase = BIP39.mnemonic(BIP39WordlistEn, 128);
});
it('should pass test vectors', function() {
var vectors = bip39_vectors['english'];

//do not run these slow tests on TRAVIS which often fails
var vectors = bip39_vectors['english'];
if (!process.env.TRAVIS && !process.env.CI) {
for (var v = 0 ; v < vectors.length ; v++) {
var vector = vectors[v];
var code = vector[0];
var mnemonic = vector[1];
var seed = vector[2];
var mnemonic1 = BIP39.entropy2mnemonic(BIP39WordlistEn, new Buffer(code, 'hex'));
var seed1 = BIP39.mnemonic2seed(mnemonic, 'TREZOR');
BIP39.check(BIP39WordlistEn, mnemonic).should.be.true;
mnemonic1.should.equal(mnemonic);
seed1.toString('hex').should.equal(seed)
(function(v){
it('should pass test vector ' + v, function() {
var vector = vectors[v];
var code = vector[0];
var mnemonic = vector[1];
var seed = vector[2];
var mnemonic1 = BIP39.entropy2mnemonic(BIP39WordlistEn, new Buffer(code, 'hex'));
var seed1 = BIP39.mnemonic2seed(mnemonic, 'TREZOR');
BIP39.check(BIP39WordlistEn, mnemonic).should.be.true;
mnemonic1.should.equal(mnemonic);
seed1.toString('hex').should.equal(seed)
});
})(v);
}
});
}

});

});