diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2016-09-05 13:57:36 +1000 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2016-09-05 13:57:36 +1000 |
commit | 4d387bf5e3fb272de3f29f0c84f54db973e63494 (patch) | |
tree | a49e2e01fad223ef1b10d51679766845885093fd | |
parent | 8a89b9da97e437f9ce9476951896e51a9764800c (diff) | |
download | BIP39-4d387bf5e3fb272de3f29f0c84f54db973e63494.tar.gz BIP39-4d387bf5e3fb272de3f29f0c84f54db973e63494.tar.zst BIP39-4d387bf5e3fb272de3f29f0c84f54db973e63494.zip |
Test additional addresses ordering
-rw-r--r-- | tests.js | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -1252,6 +1252,43 @@ page.open(url, function(status) { | |||
1252 | }, | 1252 | }, |
1253 | 1253 | ||
1254 | // Additional addresses are shown in order of derivation path | 1254 | // Additional addresses are shown in order of derivation path |
1255 | function() { | ||
1256 | page.open(url, function(status) { | ||
1257 | // set the phrase | ||
1258 | page.evaluate(function() { | ||
1259 | $(".phrase").val("abandon abandon ability").trigger("input"); | ||
1260 | }); | ||
1261 | waitForGenerate(function() { | ||
1262 | // generate more addresses | ||
1263 | page.evaluate(function() { | ||
1264 | $(".more").click(); | ||
1265 | }); | ||
1266 | // get the derivation paths | ||
1267 | waitForGenerate(function() { | ||
1268 | var paths = page.evaluate(function() { | ||
1269 | return $(".index").map(function(i, e) { | ||
1270 | return $(e).text(); | ||
1271 | }); | ||
1272 | }); | ||
1273 | if (paths.length != 40) { | ||
1274 | console.log("Total additional paths is less than expected: " + paths.length); | ||
1275 | fail(); | ||
1276 | } | ||
1277 | for (var i=0; i<paths.length; i++) { | ||
1278 | var expected = "m/44'/0'/0'/0/" + i; | ||
1279 | var actual = paths[i]; | ||
1280 | if (actual != expected) { | ||
1281 | console.log("Path " + i + " is not in correct order"); | ||
1282 | console.log("Expected: " + expected); | ||
1283 | console.log("Actual: " + actual); | ||
1284 | fail(); | ||
1285 | } | ||
1286 | } | ||
1287 | next(); | ||
1288 | }); | ||
1289 | }); | ||
1290 | }); | ||
1291 | }, | ||
1255 | 1292 | ||
1256 | // BIP32 root key can be set by the user | 1293 | // BIP32 root key can be set by the user |
1257 | // Setting BIP32 root key clears the existing phrase, passphrase and seed | 1294 | // Setting BIP32 root key clears the existing phrase, passphrase and seed |