Browse Source

break up BIP39 tests so the individual ones run faster

...so that travis stops complaining about this otherwise slow test
patch-2
Ryan X. Charles 11 years ago
parent
commit
adffabd376
  1. 32
      test/test.BIP39.js

32
test/test.BIP39.js

@ -144,20 +144,24 @@ describe('BIP39', function() {
it('should generate a mnemonic phrase', function() { it('should generate a mnemonic phrase', function() {
var phrase = BIP39.mnemonic(BIP39WordlistEn, 128); var phrase = BIP39.mnemonic(BIP39WordlistEn, 128);
}); });
it('should pass test vectors', function() {
var vectors = bip39_vectors['english']; var vectors = bip39_vectors['english'];
for (var v = 0 ; v < vectors.length ; v++) { for (var v = 0 ; v < vectors.length ; v++) {
var vector = vectors[v]; (function(v){
var code = vector[0]; it('should pass test vector ' + v, function() {
var mnemonic = vector[1]; var vector = vectors[v];
var seed = vector[2]; var code = vector[0];
var mnemonic1 = BIP39.entropy2mnemonic(BIP39WordlistEn, new Buffer(code, 'hex')); var mnemonic = vector[1];
var seed1 = BIP39.mnemonic2seed(mnemonic, 'TREZOR'); var seed = vector[2];
BIP39.check(BIP39WordlistEn, mnemonic).should.be.true; var mnemonic1 = BIP39.entropy2mnemonic(BIP39WordlistEn, new Buffer(code, 'hex'));
mnemonic1.should.equal(mnemonic); var seed1 = BIP39.mnemonic2seed(mnemonic, 'TREZOR');
seed1.toString('hex').should.equal(seed) BIP39.check(BIP39WordlistEn, mnemonic).should.be.true;
} mnemonic1.should.equal(mnemonic);
}); seed1.toString('hex').should.equal(seed)
});
})(v);
}
}); });
}); });

Loading…
Cancel
Save