mirror of https://github.com/status-im/bip39.git
adds test for randombytes
This commit is contained in:
parent
d99ec8630f
commit
1e2eb62cff
|
@ -28,6 +28,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^9.0.0",
|
||||
"mocha": "^2.2.0"
|
||||
"mocha": "^2.2.0",
|
||||
"mock-require": "^1.0.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
var assert = require('assert')
|
||||
var mock = require('mock-require')
|
||||
|
||||
mock('randombytes', function(size) {
|
||||
return new Buffer('qwertyuiopasdfghjklzxcvbnm[];,./'.slice(0, size))
|
||||
})
|
||||
|
||||
var BIP39 = require('../index.js')
|
||||
|
||||
var wordlists = {
|
||||
|
@ -63,6 +69,10 @@ describe('BIP39', function() {
|
|||
assert.equal(words.length, 9)
|
||||
})
|
||||
|
||||
it('defaults to randombytes for the RNG', function() {
|
||||
assert.equal(BIP39.generateMnemonic(32), 'imitate robot frequent')
|
||||
})
|
||||
|
||||
it('allows a custom RNG to be used', function() {
|
||||
var rng = function(size) {
|
||||
var buffer = new Buffer(size)
|
||||
|
|
Loading…
Reference in New Issue