aboutsummaryrefslogtreecommitdiff
path: root/tests/spec
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2017-11-22 12:11:48 +1100
committerIan Coleman <ian@iancoleman.io>2017-11-22 13:03:47 +1100
commitc49e881294343b762109bb8104e7c1b45898c894 (patch)
treed5977e411ccc4351de1384b611c05ef1a428c213 /tests/spec
parent0fd67b5915a08168d31caaa581f55cf86591be73 (diff)
downloadBIP39-c49e881294343b762109bb8104e7c1b45898c894.tar.gz
BIP39-c49e881294343b762109bb8104e7c1b45898c894.tar.zst
BIP39-c49e881294343b762109bb8104e7c1b45898c894.zip
Add BIP141 tab for full segwit compatibility
Diffstat (limited to 'tests/spec')
-rw-r--r--tests/spec/tests.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index f3ffbbf..2b28d73 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -2596,4 +2596,51 @@ it('Can generate more addresses from a custom index', function(done) {
2596 }); 2596 });
2597}); 2597});
2598 2598
2599it('Can generate BIP141 addresses with P2WPKH-in-P2SH semanitcs', function(done) {
2600 // Sourced from BIP49 official test specs
2601 driver.findElement(By.css('#bip141-tab a'))
2602 .click();
2603 driver.findElement(By.css('.bip141-path'))
2604 .clear();
2605 driver.findElement(By.css('.bip141-path'))
2606 .sendKeys("m/49'/1'/0'/0");
2607 selectNetwork("BTC - Bitcoin Testnet");
2608 driver.findElement(By.css(".phrase"))
2609 .sendKeys("abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about");
2610 driver.sleep(generateDelay).then(function() {
2611 getFirstAddress(function(address) {
2612 expect(address).toBe("2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2");
2613 done();
2614 });
2615 });
2616});
2617
2618it('Can generate BIP141 addresses with P2WPKH semanitcs', function(done) {
2619 // This result tested against bitcoinjs-lib test spec for segwit address
2620 // using the first private key of this mnemonic and default path m/0
2621 // https://github.com/bitcoinjs/bitcoinjs-lib/blob/9c8503cab0c6c30a95127042703bc18e8d28c76d/test/integration/addresses.js#L50
2622 // so whilst not directly comparable, substituting the private key produces
2623 // identical results between this tool and the bitcoinjs-lib test.
2624 // Private key generated is:
2625 // L3L8Nu9whawPBNLGtFqDhKut9DKKfG3CQoysupT7BimqVCZsLFNP
2626 driver.findElement(By.css('#bip141-tab a'))
2627 .click();
2628 // Choose P2WPKH
2629 driver.executeScript(function() {
2630 $(".bip141-semantics option[selected]").removeAttr("selected");
2631 $(".bip141-semantics option").filter(function(i,e) {
2632 return $(e).html() == "P2WPKH";
2633 }).prop("selected", true);
2634 $(".bip141-semantics").trigger("change");
2635 });
2636 driver.findElement(By.css(".phrase"))
2637 .sendKeys("abandon abandon ability");
2638 driver.sleep(generateDelay).then(function() {
2639 getFirstAddress(function(address) {
2640 expect(address).toBe("bc1qfwu6a5a3evygrk8zvdxxvz4547lmpyx5vsfxe9");
2641 done();
2642 });
2643 });
2644});
2645
2599}); 2646});