aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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});