Fix generateXAddress() and generateXAddress() with no entropy (#1211)

Fix #1209

Calling: Uint8Array.from(undefined)
Throws:
  TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at Function.from (<anonymous>)

* generateSeed: Pass only entropy and algorithm

* Update typescript and ripple-keypairs

* Improve unit tests

* Rename [Original Address] to [Classic Address] in test output
This commit is contained in:
Elliot Lee
2020-02-18 11:14:09 -08:00
committed by GitHub
parent 9caf077b58
commit 804094b1ce
6 changed files with 359 additions and 19 deletions

View File

@@ -32,21 +32,33 @@ describe('RippleAPI [Test Runner]', function() {
// Run all the tests:
for (const {name: methodName, tests, config} of allTestSuites) {
describe(`api.${methodName}`, () => {
// Run each test with the original-style address.
describe(`[Original Address]`, () => {
for (const [testName, fn] of tests) {
// Run each test that does not use an address.
for (const [testName, fn] of tests) {
if (fn.length === 1) {
it(testName, function() {
return fn(this.api, addresses.ACCOUNT)
})
}
}
// Run each test with a classic address.
describe(`[Classic Address]`, () => {
for (const [testName, fn] of tests) {
if (fn.length === 2) {
it(testName, function() {
return fn(this.api, addresses.ACCOUNT)
})
}
}
})
// Run each test with the newer, x-address style.
// Run each test with an X-address.
if (!config.skipXAddress) {
describe(`[X-address]`, () => {
for (const [testName, fn] of tests) {
it(testName, function() {
return fn(this.api, addresses.ACCOUNT_X)
})
if (fn.length === 2) {
it(testName, function() {
return fn(this.api, addresses.ACCOUNT_X)
})
}
}
})
}