X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fspec%2Ftests.js;h=adaeb6c42ae79e9d2b19acfea8223ec022447096;hb=f62138da711d22d9267892cb2a9f63862ee61b5b;hp=571047f340fcbf12960797ba2090bcbbf6829a3b;hpb=d1b4c8c579b34924fbce919c423f3c9baab81083;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 571047f..adaeb6c 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -553,7 +553,7 @@ it('Allows selection of slimcoin testnet', function(done) { it('Allows selection of bitcoin cash', function(done) { var params = { selectText: "BCH - Bitcoin Cash", - firstAddress: "1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A", + firstAddress: "bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps", }; testNetwork(done, params); }); @@ -900,6 +900,13 @@ it('Allows selection of Ixcoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Kobocoin', function(done) { + var params = { + selectText: "KOBO - Kobocoin", + firstAddress: "FTVoNJETXDAM8x7MnmdE8RwWndSr9PQWhy", + }; + testNetwork(done, params); +}); it('Allows selection of Landcoin', function(done) { var params = { selectText: "LDCN - Landcoin", @@ -1159,6 +1166,13 @@ it('Allows selection of Zcoin', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Zcash', function(done) { + var params = { + selectText: "ZEC - Zcash", + firstAddress: "t1Sz8AneMcVuzUg3tPJ8et5AS5LFJ7K2EF9", + }; + testNetwork(done, params); +}); // BIP39 seed is set from phrase @@ -3106,10 +3120,26 @@ it('Warns when entropy is filtered and discarded', function(done) { }); }); +// Bitcoin Cash address can be set to use cashaddr format +it('Can use cashaddr format for bitcoin cash addresses', function(done) { + driver.executeScript(function() { + $(".use-bch-cashaddr-addresses").prop("checked", true); + }); + driver.findElement(By.css('.phrase')) + .sendKeys("abandon abandon ability"); + selectNetwork("BCH - Bitcoin Cash"); + driver.sleep(generateDelay).then(function() { + getFirstAddress(function(address) { + expect(address).toBe("bitcoincash:qzlquk7w4hkudxypl4fgv8x279r754dkvur7jpcsps"); + done(); + }); + }); +}); + // Bitcoin Cash address can be set to use bitpay format it('Can use bitpay format for bitcoin cash addresses', function(done) { driver.executeScript(function() { - $(".use-bitpay-addresses").prop("checked", true); + $(".use-bch-bitpay-addresses").prop("checked", true); }); driver.findElement(By.css('.phrase')) .sendKeys("abandon abandon ability"); @@ -3122,6 +3152,22 @@ it('Can use bitpay format for bitcoin cash addresses', function(done) { }); }); +// Bitcoin Cash address can be set to use legacy format +it('Can use legacy format for bitcoin cash addresses', function(done) { + driver.executeScript(function() { + $(".use-bch-legacy-addresses").prop("checked", true); + }); + driver.findElement(By.css('.phrase')) + .sendKeys("abandon abandon ability"); + selectNetwork("BCH - Bitcoin Cash"); + driver.sleep(generateDelay).then(function() { + getFirstAddress(function(address) { + expect(address).toBe("1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A"); + 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) { @@ -3503,4 +3549,63 @@ it('Uses vprv for bitcoin testnet p2wpkh', function(done) { }); }); +it('Shows a warning if generating weak mnemonics', function(done) { + driver.executeScript(function() { + $(".strength option[selected]").removeAttr("selected"); + $(".strength option[value=6]").prop("selected", true); + $(".strength").trigger("change"); + }); + driver.findElement(By.css(".generate-container .warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).not.toContain("hidden"); + done(); + }); +}); + +it('Does not show a warning if generating strong mnemonics', function(done) { + driver.executeScript(function() { + $(".strength option[selected]").removeAttr("selected"); + $(".strength option[value=12]").prop("selected", true); + }); + driver.findElement(By.css(".generate-container .warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).toContain("hidden"); + done(); + }); +}); + +it('Shows a warning if overriding weak entropy with longer mnemonics', function(done) { + driver.findElement(By.css('.use-entropy')) + .click(); + driver.findElement(By.css('.entropy')) + .sendKeys("0123456789abcdef"); // 6 words + driver.executeScript(function() { + $(".mnemonic-length").val("12").trigger("change"); + }); + driver.findElement(By.css(".weak-entropy-override-warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).not.toContain("hidden"); + done(); + }); +}); + +it('Does not show a warning if entropy is stronger than mnemonic length', function(done) { + driver.findElement(By.css('.use-entropy')) + .click(); + driver.findElement(By.css('.entropy')) + .sendKeys("0123456789abcdef0123456789abcdef0123456789abcdef"); // 18 words + driver.executeScript(function() { + $(".mnemonic-length").val("12").trigger("change"); + }); + driver.findElement(By.css(".weak-entropy-override-warning")) + .getAttribute("class") + .then(function(classes) { + expect(classes).toContain("hidden"); + done(); + }); +}); + });