]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Merge pull request #29 from dangershony/master
authoriancoleman <coleman.ian@gmail.com>
Tue, 30 Aug 2016 05:49:49 +0000 (15:49 +1000)
committerGitHub <noreply@github.com>
Tue, 30 Aug 2016 05:49:49 +0000 (15:49 +1000)
Adding peercoin and namecoin

tests.js

index 47938a4b54a0905e3db20eae0124ad0a8daab2ee..f82ce0d98ed975ecbf9a216e3f591fa8c991dd30 100644 (file)
--- a/tests.js
+++ b/tests.js
@@ -978,7 +978,6 @@ page.open(url, function(status) {
         $(".phrase").val("abandon abandon ability");
         $(".phrase").trigger("input");
     });
-    // check the path is not shown
     waitForGenerate(function() {
         // toggle path visibility
         page.evaluate(function() {
@@ -1022,9 +1021,113 @@ page.open(url, function(status) {
 },
 
 // Addresses are shown in order of derivation path
+function() {
+page.open(url, function(status) {
+    // set the phrase
+    page.evaluate(function() {
+        $(".phrase").val("abandon abandon ability").trigger("input");
+    });
+    // get the derivation paths
+    waitForGenerate(function() {
+        var paths = page.evaluate(function() {
+            return $(".index").map(function(i, e) {
+                return $(e).text();
+            });
+        });
+        if (paths.length != 20) {
+            console.log("Total paths is less than expected: " + paths.length);
+            fail();
+        }
+        for (var i=0; i<paths.length; i++) {
+            var expected = "m/44'/0'/0'/0/" + i;
+            var actual = paths[i];
+            if (actual != expected) {
+                console.log("Path " + i + " is incorrect");
+                console.log("Expected: " + expected);
+                console.log("Actual: " + actual);
+                fail();
+            }
+        }
+        next();
+    });
+});
+},
+
 // Address visibility can be toggled
+function() {
+page.open(url, function(status) {
+    // set the phrase
+    page.evaluate(function() {
+        $(".phrase").val("abandon abandon ability");
+        $(".phrase").trigger("input");
+    });
+    waitForGenerate(function() {
+        // toggle address visibility
+        page.evaluate(function() {
+            $(".address-toggle").click();
+        });
+        // check the address is not visible
+        var isInvisible = page.evaluate(function() {
+            return $(".address:first span").hasClass("invisible");
+        });
+        if (!isInvisible) {
+            console.log("Toggled address is visible");
+            fail();
+        }
+        next();
+    });
+});
+},
+
 // Private key is shown
+function() {
+page.open(url, function(status) {
+    var expected = "L26cVSpWFkJ6aQkPkKmTzLqTdLJ923e6CzrVh9cmx21QHsoUmrEE";
+    // set the phrase
+    page.evaluate(function() {
+        $(".phrase").val("abandon abandon ability").trigger("input");
+    });
+    // get the address
+    waitForGenerate(function() {
+        var actual = page.evaluate(function() {
+            return $(".privkey:first").text();
+        });
+        if (actual != expected) {
+            console.log("Private key is not shown");
+            console.log("Expected: " + expected);
+            console.log("Got: " + actual);
+            fail();
+        }
+        next();
+    });
+});
+},
+
 // Private key visibility can be toggled
+function() {
+page.open(url, function(status) {
+    // set the phrase
+    page.evaluate(function() {
+        $(".phrase").val("abandon abandon ability");
+        $(".phrase").trigger("input");
+    });
+    waitForGenerate(function() {
+        // toggle private key visibility
+        page.evaluate(function() {
+            $(".private-key-toggle").click();
+        });
+        // check the private key is not visible
+        var isInvisible = page.evaluate(function() {
+            return $(".privkey:first span").hasClass("invisible");
+        });
+        if (!isInvisible) {
+            console.log("Toggled private key is visible");
+            fail();
+        }
+        next();
+    });
+});
+},
 
 // More addresses can be generated
 // A custom number of additional addresses can be generated