bip39/test/index.js

29 lines
727 B
JavaScript
Raw Normal View History

2014-03-10 02:49:53 +00:00
var vectors = require('./vectors.json').english
2014-03-11 04:38:09 +00:00
var BIP39 = require('../index.js')
var wordlist = require('../Wordlists/en.json')
2014-03-10 02:49:53 +00:00
var assert = require('assert')
2014-03-11 08:01:14 +00:00
var bip39 = new BIP39()
2014-03-11 04:38:09 +00:00
describe('constructor', function(){
it('defaults language to english', function(){
assert.deepEqual(bip39.wordlist, wordlist)
})
})
2014-03-10 02:49:53 +00:00
describe('mnemonicToSeed', function(){
2014-03-10 02:57:46 +00:00
vectors.forEach(function(v, i){
it('works for tests vector ' + i, function(){
2014-03-10 02:49:53 +00:00
assert.equal(bip39.mnemonicToSeed(v[1], 'TREZOR'), v[2])
})
})
})
2014-03-11 08:01:14 +00:00
describe('entropyToMnemonic', function(){
vectors.forEach(function(v, i){
it('works for tests vector ' + i, function(){
assert.equal(bip39.entropyToMnemonic(v[0]), v[1])
})
})
})