Skip to content

Commit

Permalink
Restore README 2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
junderw committed Feb 25, 2023
1 parent 69f5170 commit ba92376
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions test/readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ test('README example 1', function (t) {
t.equal(bip39.mnemonicToEntropy(mnemonic), entropy)
})

// test('README example 2', function (t) {
// const stub = {
// randombytes: function (size) {
// return Buffer.from('qwertyuiopasdfghjklzxcvbnm[];,./'.slice(0, size), 'utf8')
// }
// }
// const proxiedbip39 = proxyquire('../', stub)

// // mnemonic strength defaults to 128 bits
// const mnemonic = proxiedbip39.generateMnemonic()

// t.plan(2)
// t.equal(mnemonic, 'imitate robot frame trophy nuclear regret saddle around inflict case oil spice')
// t.equal(bip39.validateMnemonic(mnemonic), true)
// })
test('README example 2', function (t) {
const stub = {
'@noble/hashes/utils': {
randomBytes: function (size) {
return Uint8Array.from(Buffer.from('qwertyuiopasdfghjklzxcvbnm[];,./'.slice(0, size), 'utf8'))
}
}
}
const proxiedbip39 = proxyquire('../', stub)

// mnemonic strength defaults to 128 bits
const mnemonic = proxiedbip39.generateMnemonic()

t.plan(2)
t.equal(mnemonic, 'imitate robot frame trophy nuclear regret saddle around inflict case oil spice')
t.equal(bip39.validateMnemonic(mnemonic), true)
})

test('README example 3', function (t) {
const mnemonic = 'basket actual'
Expand Down

0 comments on commit ba92376

Please sign in to comment.