aboutsummaryrefslogtreecommitdiff
path: root/tests.js
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2017-02-19 12:38:18 +1100
committerIan Coleman <coleman.ian@gmail.com>2017-02-19 12:38:18 +1100
commitcdfaaf00c6fb48b9b5d1070ea8ca89e451f071bd (patch)
tree7ee3398a364189411f4a9fdaaa2de6837d662456 /tests.js
parent6ee4fb7da1b9da58214ab7fbec7720b75542a737 (diff)
downloadBIP39-cdfaaf00c6fb48b9b5d1070ea8ca89e451f071bd.tar.gz
BIP39-cdfaaf00c6fb48b9b5d1070ea8ca89e451f071bd.tar.zst
BIP39-cdfaaf00c6fb48b9b5d1070ea8ca89e451f071bd.zip
BIP32 client select tests
Diffstat (limited to 'tests.js')
-rw-r--r--tests.js96
1 files changed, 96 insertions, 0 deletions
diff --git a/tests.js b/tests.js
index 89f4ce3..debedab 100644
--- a/tests.js
+++ b/tests.js
@@ -3419,6 +3419,102 @@ page.open(url, function(status) {
3419}); 3419});
3420}, 3420},
3421 3421
3422// Github pull request 55
3423// https://github.com/iancoleman/bip39/pull/55
3424// Client select
3425function() {
3426page.open(url, function(status) {
3427 // set mnemonic and select bip32 tab
3428 page.evaluate(function() {
3429 $("#bip32-tab a").click();
3430 $(".phrase").val("abandon abandon ability").trigger("input");
3431 });
3432 waitForGenerate(function() {
3433 // BITCOIN CORE
3434 // set bip32 client to bitcoin core
3435 page.evaluate(function() {
3436 var bitcoinCoreIndex = "0";
3437 $("#bip32-client").val(bitcoinCoreIndex).trigger("change");
3438 });
3439 waitForGenerate(function() {
3440 // get the derivation path
3441 var actual = page.evaluate(function() {
3442 return $("#bip32-path").val();
3443 });
3444 // check the derivation path is correct
3445 expected = "m/0'/0'"
3446 if (actual != expected) {
3447 console.log("Selecting Bitcoin Core client does not set correct derivation path");
3448 console.log("Expected: " + expected);
3449 console.log("Actual: " + actual);
3450 fail();
3451 }
3452 // get hardened addresses
3453 var usesHardenedAddresses = page.evaluate(function() {
3454 return $(".hardened-addresses").prop("checked");
3455 });
3456 // check hardened addresses is selected
3457 if(!usesHardenedAddresses) {
3458 console.log("Selecting Bitcoin Core client does not use hardened addresses");
3459 fail();
3460 }
3461 // check input is readonly
3462 var pathIsReadonly = page.evaluate(function() {
3463 return $("#bip32-path").prop("readonly");
3464 });
3465 if (!pathIsReadonly) {
3466 console.log("Selecting Bitcoin Core client does not set derivation path to readonly");
3467 fail();
3468 }
3469 // MULTIBIT
3470 // set bip32 client to multibit
3471 page.evaluate(function() {
3472 var multibitIndex = "2";
3473 $("#bip32-client").val(multibitIndex).trigger("change");
3474 });
3475 waitForGenerate(function() {
3476 // get the derivation path
3477 var actual = page.evaluate(function() {
3478 return $("#bip32-path").val();
3479 });
3480 // check the derivation path is correct
3481 expected = "m/0'/0"
3482 if (actual != expected) {
3483 console.log("Selecting Multibit client does not set correct derivation path");
3484 console.log("Expected: " + expected);
3485 console.log("Actual: " + actual);
3486 fail();
3487 }
3488 // get hardened addresses
3489 var usesHardenedAddresses = page.evaluate(function() {
3490 return $(".hardened-addresses").prop("checked");
3491 });
3492 // check hardened addresses is selected
3493 if(usesHardenedAddresses) {
3494 console.log("Selecting Multibit client does not uncheck hardened addresses");
3495 fail();
3496 }
3497 // CUSTOM DERIVATION PATH
3498 // check input is not readonly
3499 page.evaluate(function() {
3500 $("#bip32-client").val("custom").trigger("change");
3501 });
3502 // do not wait for generate, since there is no change to the
3503 // derivation path there is no new generation performed
3504 var pathIsReadonly = page.evaluate(function() {
3505 return $("#bip32-path").prop("readonly");
3506 });
3507 if (pathIsReadonly) {
3508 console.log("Selecting Custom Derivation Path does not allow derivation path input");
3509 fail();
3510 }
3511 next();
3512 });
3513 });
3514 });
3515});
3516},
3517
3422// If you wish to add more tests, do so here... 3518// If you wish to add more tests, do so here...
3423 3519
3424// Here is a blank test template 3520// Here is a blank test template