]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Test mnemonic is not sensitive to whitespace
authorIan Coleman <coleman.ian@gmail.com>
Wed, 5 Oct 2016 01:11:31 +0000 (12:11 +1100)
committerIan Coleman <coleman.ian@gmail.com>
Wed, 5 Oct 2016 01:11:31 +0000 (12:11 +1100)
tests.js

index 35c735e8697b519dfbe4c0c8861b8bd647e4b0e2..c09a8fd8f6f0bcc3492da788cb7659d6b8fb0c39 100644 (file)
--- a/tests.js
+++ b/tests.js
@@ -1627,6 +1627,30 @@ page.open(url, function(status) {
 
 // Github Issue 19: Mnemonic is not sensitive to whitespace
 // https://github.com/dcpos/bip39/issues/19
+function() {
+page.open(url, function(status) {
+    // set the phrase
+    var expected = "xprv9s21ZrQH143K3isaZsWbKVoTtbvd34Y1ZGRugGdMeBGbM3AgBVzTH159mj1cbbtYSJtQr65w6L5xy5L9SFC7c9VJZWHxgAzpj4mun5LhrbC";
+    page.evaluate(function() {
+        var doubleSpace = "  ";
+        $(".phrase").val("urge cat" + doubleSpace + "bid");
+        $(".phrase").trigger("input");
+    });
+    waitForGenerate(function() {
+        // Check the bip32 root key is correct
+        var actual = page.evaluate(function() {
+            return $(".root-key").val();
+        });
+        if (actual != expected) {
+            console.log("Mnemonic is sensitive to whitespace");
+            console.log("Expected: " + expected);
+            console.log("Actual: " + actual);
+            fail();
+        }
+        next();
+    });
+});
+},
 
 // Github Issue 23: Use correct derivation path when changing tabs
 // https://github.com/dcpos/bip39/issues/23