]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blobdiff - tests/spec/tests.js
Add BTCP, BTCZ, ZCL, ZEN
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / tests / spec / tests.js
index 945a9232adfffb91d514ed0f1befad6a1e3b2969..94fc67225bde24ff689efb227a63a1f7c8bdd8cc 100644 (file)
@@ -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);
 });
@@ -690,6 +690,20 @@ it('Allows selection of Bitcoinplus', function(done) {
     };
     testNetwork(done, params);
 });
+it('Allows selection of Bitcoin Private', function(done) {
+    var params = {
+        selectText: "BTCP - Bitcoin Private",
+        firstAddress: "b1M3PbiXXyN6Hdivdw5rJv5VKpLjPzhm4jM",
+    };
+    testNetwork(done, params);
+});
+it('Allows selection of Bitcoinz', function(done) {
+    var params = {
+        selectText: "BTCZ - Bitcoinz",
+        firstAddress: "t1X2YQoxs8cYRo2oaBYgVEwW5QNjCC59NYc",
+    };
+    testNetwork(done, params);
+});
 it('Allows selection of Bitcore', function(done) {
     var params = {
         selectText: "BTX - Bitcore",
@@ -900,6 +914,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 +1180,34 @@ 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);
+});
+it('Allows selection of Zclassic', function(done) {
+    var params = {
+        selectText: "ZCL - Zclassic",
+        firstAddress: "t1TBMxTvVJRybUbMLGWq8H4A8F4VUL7czEc",
+    };
+    testNetwork(done, params);
+});
+it('Allows selection of Zencash', function(done) {
+    var params = {
+        selectText: "ZEN - Zencash",
+        firstAddress: "znWh9XASyW2dZq5tck84wFjiwuqVysi7q3p",
+    };
+    testNetwork(done, params);
+});
+it('Allows selection of Energi', function(done) {
+    var params = {
+        selectText: "NRG - Energi",
+        firstAddress: "EejRy4t4nidzhGGzkJUgFP3z4HYBjhTsRt",
+    };
+    testNetwork(done, params);
+});
 
 
 // BIP39 seed is set from phrase
@@ -3106,10 +3155,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 +3187,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) {
@@ -3530,4 +3611,36 @@ it('Does not show a warning if generating strong mnemonics', function(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();
+        });
+});
+
 });