Browse Source

fix string uniform test

[#15]
300
Wei Lu 10 years ago
parent
commit
3491c3d13e
  1. 12
      test/index.js
  2. 7
      test/vectors.json

12
test/index.js

@ -122,15 +122,11 @@ describe('BIP39', function() {
})
describe('utf8 passwords', function() {
vectors.japanese.forEach(function(v, i) {
it ('creates the correct seed', function() {
var mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
// Note that mocha does not support string normalization, so this
// fails if just the utf8_password is used. This is a mocha problem,
// not the library problem.
var utf8_password = "㍍ガバヴァぱばぐゞちぢ十人十色"
var utf8_password_normalized = "メートルガバヴァぱばぐゞちぢ十人十色"
var seed = "ba553eedefe76e67e2602dc20184c564010859faada929a090dd2c57aacb204ceefd15404ab50ef3e8dbeae5195aeae64b0def4d2eead1cdc728a33ced520ffd"
assert.equal(BIP39.mnemonicToSeedHex(mnemonic, utf8_password_normalized), seed)
var utf8_password = "㍍ガバヴァぱばぐゞちぢ十人十色"
assert.equal(BIP39.mnemonicToSeedHex(v[1], utf8_password), v[2])
})
})
})
})

7
test/vectors.json

@ -132,5 +132,12 @@
"b3y0nd 5tag3 5l33p cl1p b3cau53 tw15t t0k3n l3af at0m b3auty g3n1u5 f00d bu51n355 51d3 gr1d unabl3 m1ddl3 arm3d 0b53rv3 pa1r cr0uch t0n1ght away c0c0nut",
"b15509eaa2d09d3efd3e006ef42151b30367dc6e3aa5e44caba3fe4d3e352e65101fbdb86a96776b91946ff06f8eac594dc6ee1d3e82a42dfe1b40fef6bcc3fd"
]
],
"japanese": [
[
"00000000000000000000000000000000",
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
"ba553eedefe76e67e2602dc20184c564010859faada929a090dd2c57aacb204ceefd15404ab50ef3e8dbeae5195aeae64b0def4d2eead1cdc728a33ced520ffd"
]
]
}

Loading…
Cancel
Save