mirror of https://github.com/status-im/bip39.git
tests: code formatting
This commit is contained in:
parent
4ddf561dd0
commit
8408ed79d7
|
@ -5,45 +5,45 @@ var vectors = require('./vectors.json').english
|
|||
var BIP39 = require('../index.js')
|
||||
var bip39 = new BIP39()
|
||||
|
||||
describe('constructor', function(){
|
||||
it('defaults language to english', function(){
|
||||
describe('constructor', function() {
|
||||
it('defaults language to english', function() {
|
||||
assert.deepEqual(bip39.wordlist, wordlist)
|
||||
})
|
||||
})
|
||||
|
||||
describe('mnemonicToSeed', function(){
|
||||
vectors.forEach(function(v, i){
|
||||
it('works for tests vector ' + i, function(){
|
||||
describe('mnemonicToSeed', function() {
|
||||
vectors.forEach(function(v, i) {
|
||||
it('works for tests vector ' + i, function() {
|
||||
assert.equal(bip39.mnemonicToSeed(v[1], 'TREZOR'), v[2])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('entropyToMnemonic', function(){
|
||||
vectors.forEach(function(v, i){
|
||||
it('works for tests vector ' + i, function(){
|
||||
describe('entropyToMnemonic', function() {
|
||||
vectors.forEach(function(v, i) {
|
||||
it('works for tests vector ' + i, function() {
|
||||
assert.equal(bip39.entropyToMnemonic(v[0]), v[1])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('validate', function(){
|
||||
vectors.forEach(function(v, i){
|
||||
it('passes check ' + i, function(){
|
||||
describe('validate', function() {
|
||||
vectors.forEach(function(v, i) {
|
||||
it('passes check ' + i, function() {
|
||||
assert(bip39.validate(v[1]))
|
||||
})
|
||||
})
|
||||
|
||||
it('fails for mnemonics of wrong length', function(){
|
||||
it('fails for mnemonics of wrong length', function() {
|
||||
assert(!bip39.validate('sleep kitten'))
|
||||
assert(!bip39.validate('sleep kitten sleep kitten sleep kitten'))
|
||||
})
|
||||
|
||||
it('fails for mnemonics that contains words not from the word list', function(){
|
||||
it('fails for mnemonics that contains words not from the word list', function() {
|
||||
assert(!bip39.validate("turtle front uncle idea crush write shrug there lottery flower risky shell"))
|
||||
})
|
||||
|
||||
it('fails for mnemonics of invalid checksum', function(){
|
||||
it('fails for mnemonics of invalid checksum', function() {
|
||||
assert(!bip39.validate('sleep kitten sleep kitten sleep kitten sleep kitten sleep kitten sleep kitten'))
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue