X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fspec%2Ftests.js;h=4f774e8d0693ee7b85165f5d6664185793ed4e18;hb=1c2b8c6b2d77cdb0162f040c07d25bbe7cafe7c2;hp=72edd281d19efe7e494b74748124a9d93b853595;hpb=0460b53f3aff1745fd2727c094d12f90cfbe1d10;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 72edd28..4f774e8 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -577,6 +577,20 @@ it('Allows selection of nubits', function(done) { }; testNetwork(done, params); }); +it('Allows selection of bitcoin gold', function(done) { + var params = { + selectText: "BTG - Bitcoin Gold", + firstAddress: "GWYxuwSqANWGV3WT7Gpr6HE91euYXBqtwQ", + }; + testNetwork(done, params); +}); +it('Allows selection of monacoin', function(done) { + var params = { + selectText: "MONA - Monacoin", + firstAddress: "MKMiMr7MyjDKjJbCBzgF6u4ByqTS4NkRB1", + }; + testNetwork(done, params); +}); // BIP39 seed is set from phrase it('Sets the bip39 seed from the prhase', function(done) { @@ -2459,11 +2473,11 @@ it('Shows error for hardened addresses with xpub root key', function(done) { }); }); -// Litecoin uses xprv by default, and can optionally be set to ltpv +// Litecoin uses ltub by default, and can optionally be set to xprv // github issue 96 // https://github.com/iancoleman/bip39/issues/96 // Issue with extended keys on Litecoin -it('Uses xprv by default for litecoin, but can be set to ltpv', function(done) { +it('Uses ltub by default for litecoin, but can be set to xprv', function(done) { driver.findElement(By.css('.phrase')) .sendKeys("abandon abandon ability"); selectNetwork("LTC - Litecoin"); @@ -2472,17 +2486,17 @@ it('Uses xprv by default for litecoin, but can be set to ltpv', function(done) { driver.findElement(By.css('.root-key')) .getAttribute("value") .then(function(rootKey) { - expect(rootKey).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi"); + expect(rootKey).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU"); // set litecoin to use ltub driver.executeScript(function() { - $(".litecoin-use-ltub").prop("checked", true); + $(".litecoin-use-ltub").prop("checked", false); $(".litecoin-use-ltub").trigger("change"); }); driver.sleep(generateDelay).then(function() { driver.findElement(By.css('.root-key')) .getAttribute("value") .then(function(rootKey) { - expect(rootKey).toBe("Ltpv71G8qDifUiNesiPqf6h5V6eQ8ic77oxQiYtawiACjBEx3sTXNR2HGDGnHETYxESjqkMLFBkKhWVq67ey1B2MKQXannUqNy1RZVHbmrEjnEU"); + expect(rootKey).toBe("xprv9s21ZrQH143K2jkGDCeTLgRewT9F2pH5JZs2zDmmjXes34geVnFiuNa8KTvY5WoYvdn4Ag6oYRoB6cXtc43NgJAEqDXf51xPm6fhiMCKwpi"); done(); }); }) @@ -2563,4 +2577,48 @@ it('Can use bitpay format for bitcoin cash addresses', function(done) { }); }); +// End of tests ported from old suit, so no more comments above each test now + +it('Can generate more addresses from a custom index', function(done) { + var expectedIndexes = [ + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, + 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 + ]; + driver.findElement(By.css('.phrase')) + .sendKeys("abandon abandon ability"); + driver.sleep(generateDelay).then(function() { + // Set start of next lot of rows to be from index 40 + // which means indexes 20-39 will not be in the table. + driver.findElement(By.css('.more-rows-start-index')) + .sendKeys("40"); + driver.findElement(By.css('.more')) + .click(); + driver.sleep(generateDelay).then(function() { + // Check actual indexes in the table match the expected pattern + driver.findElements(By.css(".index")) + .then(function(els) { + expect(els.length).toBe(expectedIndexes.length); + var testRowAtIndex = function(i) { + if (i >= expectedIndexes.length) { + done(); + } + else { + els[i].getText() + .then(function(actualPath) { + var noHardened = actualPath.replace(/'/g, ""); + var pathBits = noHardened.split("/") + var lastBit = pathBits[pathBits.length-1]; + var actualIndex = parseInt(lastBit); + var expectedIndex = expectedIndexes[i]; + expect(actualIndex).toBe(expectedIndex); + testRowAtIndex(i+1); + }); + } + } + testRowAtIndex(0); + }); + }); + }); +}); + });