]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blobdiff - tests/spec/tests.js
Add bitcoin regtest params
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / tests / spec / tests.js
index bbc1f570207a75c8aefdf71fea80ff3b059b203f..260ff2c73a72b9eadfb44e6047387de18784bf14 100644 (file)
@@ -412,6 +412,13 @@ it('Allows selection of bitcoin testnet', function(done) {
     };
     testNetwork(done, params);
 });
+it('Allows selection of bitcoin regtest', function(done) {
+    var params = {
+        selectText: "BTC - Bitcoin RegTest",
+        firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi",
+    };
+    testNetwork(done, params);
+});
 it('Allows selection of litecoin', function(done) {
     var params = {
         selectText: "LTC - Litecoin",
@@ -4243,7 +4250,7 @@ it('Converts mnemonics into raw entropy', function(done) {
         driver.findElement(By.css('.entropy'))
             .getAttribute("value")
             .then(function(entropy) {
-                expect(entropy).toBe("00000000000000000000000000000001");
+                expect(entropy).toBe("00000001");
                 driver.findElement(By.css('.phrase'))
                     .getAttribute("value")
                     .then(function(phrase) {
@@ -4285,4 +4292,48 @@ it('Shows split prase cards', function(done) {
     });
 });
 
+// It allows manually specifying the entropy type
+it('Allows entropy type to be manually selected', function(done) {
+    driver.findElement(By.css('.use-entropy'))
+        .click();
+    // use decimal entropy
+    driver.findElement(By.css('.entropy'))
+        .sendKeys("91");
+    // manually change to binary entropy
+    driver.executeScript(function() {
+        $(".entropy-container input[value='binary']").click();
+    });
+    driver.sleep(entropyFeedbackDelay).then(function() {
+        driver.findElement(By.css('.entropy-container'))
+            .getText()
+            .then(function(text) {
+                // overide 91 to be just 1
+                var key = "Filtered Entropy";
+                var value = "1";
+                var reText = key + "\\s+" + value;
+                var re = new RegExp(reText);
+                expect(text).toMatch(re);
+                // overide automatic decimal to binary
+                var key = "Entropy Type";
+                var value = "binary";
+                var reText = key + "\\s+" + value;
+                var re = new RegExp(reText);
+                expect(text).toMatch(re);
+                // overide 2 events to 1
+                var key = "Event Count";
+                var value = 1;
+                var reText = key + "\\s+" + value;
+                var re = new RegExp(reText);
+                expect(text).toMatch(re);
+                // overide log2(10)*2 bits to 1 bit
+                var key = "Total Bits";
+                var value = 1;
+                var reText = key + "\\s+" + value;
+                var re = new RegExp(reText);
+                expect(text).toMatch(re);
+                done();
+            });
+    });
+});
+
 });