From: Ian Coleman Date: Wed, 24 Aug 2016 05:45:25 +0000 (+1000) Subject: Test extended priv/pub keys with BIP32 tab X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=9e9dcfdaa38eeb1e7d19d6eedb8bfe1b18880f56;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FBIP39.git Test extended priv/pub keys with BIP32 tab --- diff --git a/tests.js b/tests.js index 1871163..2c304f3 100644 --- a/tests.js +++ b/tests.js @@ -819,7 +819,66 @@ page.open(url, function(status) { }, // BIP32 extended private key is shown +function() { +page.open(url, function(status) { + // set the phrase + var expected = "xprv9va99uTVE5aLiutUVLTyfxfe8v8aaXjSQ1XxZbK6SezYVuikA9MnjQVTA8rQHpNA5LKvyQBpLiHbBQiiccKiBDs7eRmBogsvq3THFeLHYbe"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + }); + // change tabs + waitForGenerate(function() { + page.evaluate(function() { + $("#bip32-tab a").click(); + }); + // check the extended private key is generated correctly + waitForGenerate(function() { + var actual = page.evaluate(function() { + return $(".extended-priv-key").val(); + }); + if (actual != expected) { + console.log("BIP32 extended private key is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }); + }); +}); +}, + // BIP32 extended public key is shown +function() { +page.open(url, function(status) { + // set the phrase + var expected = "xpub69ZVZQzP4T8dwPxwbMzz36cNgwy4yzTHmETZMyihzzXXNi3thgg3HCow1RtY252wdw5rS8369xKnraN5Q93y3FkFfJp2XEHWUrkyXsjS93P"; + page.evaluate(function() { + $(".phrase").val("abandon abandon ability"); + $(".phrase").trigger("input"); + }); + // change tabs + waitForGenerate(function() { + page.evaluate(function() { + $("#bip32-tab a").click(); + }); + // check the extended public key is generated correctly + waitForGenerate(function() { + var actual = page.evaluate(function() { + return $(".extended-pub-key").val(); + }); + if (actual != expected) { + console.log("BIP32 extended public key is incorrect"); + console.log("Expected: " + expected); + console.log("Actual: " + actual); + fail(); + } + next(); + }); + }); +}); +}, // Derivation path is shown in table // Derivation path for address can be hardened