diff options
author | Ian Coleman <ian@iancoleman.io> | 2017-11-21 12:06:56 +1100 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2017-11-21 12:06:56 +1100 |
commit | 9183f9f658222dc3a24c8b4794887b6ecd80ba1e (patch) | |
tree | 6c3fdc47c20562bed4bdc297f4e96d610ba9f3d0 /tests | |
parent | f487fea9b8b37642a3940be63129d9835eb77229 (diff) | |
download | BIP39-9183f9f658222dc3a24c8b4794887b6ecd80ba1e.tar.gz BIP39-9183f9f658222dc3a24c8b4794887b6ecd80ba1e.tar.zst BIP39-9183f9f658222dc3a24c8b4794887b6ecd80ba1e.zip |
Allow more rows to be generated at a custom index
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spec/tests.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 998809a..f10f7a4 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -2577,4 +2577,48 @@ it('Can use bitpay format for bitcoin cash addresses', function(done) { | |||
2577 | }); | 2577 | }); |
2578 | }); | 2578 | }); |
2579 | 2579 | ||
2580 | // End of tests ported from old suit, so no more comments above each test now | ||
2581 | |||
2582 | it('Can generate more addresses from a custom index', function(done) { | ||
2583 | var expectedIndexes = [ | ||
2584 | 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, | ||
2585 | 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 | ||
2586 | ]; | ||
2587 | driver.findElement(By.css('.phrase')) | ||
2588 | .sendKeys("abandon abandon ability"); | ||
2589 | driver.sleep(generateDelay).then(function() { | ||
2590 | // Set start of next lot of rows to be from index 40 | ||
2591 | // which means indexes 20-39 will not be in the table. | ||
2592 | driver.findElement(By.css('.more-rows-start-index')) | ||
2593 | .sendKeys("40"); | ||
2594 | driver.findElement(By.css('.more')) | ||
2595 | .click(); | ||
2596 | driver.sleep(generateDelay).then(function() { | ||
2597 | // Check actual indexes in the table match the expected pattern | ||
2598 | driver.findElements(By.css(".index")) | ||
2599 | .then(function(els) { | ||
2600 | expect(els.length).toBe(expectedIndexes.length); | ||
2601 | var testRowAtIndex = function(i) { | ||
2602 | if (i >= expectedIndexes.length) { | ||
2603 | done(); | ||
2604 | } | ||
2605 | else { | ||
2606 | els[i].getText() | ||
2607 | .then(function(actualPath) { | ||
2608 | var noHardened = actualPath.replace(/'/g, ""); | ||
2609 | var pathBits = noHardened.split("/") | ||
2610 | var lastBit = pathBits[pathBits.length-1]; | ||
2611 | var actualIndex = parseInt(lastBit); | ||
2612 | var expectedIndex = expectedIndexes[i]; | ||
2613 | expect(actualIndex).toBe(expectedIndex); | ||
2614 | testRowAtIndex(i+1); | ||
2615 | }); | ||
2616 | } | ||
2617 | } | ||
2618 | testRowAtIndex(0); | ||
2619 | }); | ||
2620 | }); | ||
2621 | }); | ||
2622 | }); | ||
2623 | |||
2580 | }); | 2624 | }); |