diff options
author | Ian Coleman <ian@iancoleman.io> | 2018-04-12 12:16:05 +1000 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2018-04-12 12:16:05 +1000 |
commit | 645945a00fe588064d33dca49f75f27e08b8f11e (patch) | |
tree | 2e4de22d9dcc064141cc79c007852f9b19e1b31f /tests | |
parent | 85c906727a24ab97a3c2908c72ad37ad988ecb01 (diff) | |
download | BIP39-645945a00fe588064d33dca49f75f27e08b8f11e.tar.gz BIP39-645945a00fe588064d33dca49f75f27e08b8f11e.tar.zst BIP39-645945a00fe588064d33dca49f75f27e08b8f11e.zip |
Warn when using weak entropy and strong mnemonic
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spec/tests.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 945a923..034b50f 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -3530,4 +3530,36 @@ it('Does not show a warning if generating strong mnemonics', function(done) { | |||
3530 | }); | 3530 | }); |
3531 | }); | 3531 | }); |
3532 | 3532 | ||
3533 | it('Shows a warning if overriding weak entropy with longer mnemonics', function(done) { | ||
3534 | driver.findElement(By.css('.use-entropy')) | ||
3535 | .click(); | ||
3536 | driver.findElement(By.css('.entropy')) | ||
3537 | .sendKeys("0123456789abcdef"); // 6 words | ||
3538 | driver.executeScript(function() { | ||
3539 | $(".mnemonic-length").val("12").trigger("change"); | ||
3540 | }); | ||
3541 | driver.findElement(By.css(".weak-entropy-override-warning")) | ||
3542 | .getAttribute("class") | ||
3543 | .then(function(classes) { | ||
3544 | expect(classes).not.toContain("hidden"); | ||
3545 | done(); | ||
3546 | }); | ||
3547 | }); | ||
3548 | |||
3549 | it('Does not show a warning if entropy is stronger than mnemonic length', function(done) { | ||
3550 | driver.findElement(By.css('.use-entropy')) | ||
3551 | .click(); | ||
3552 | driver.findElement(By.css('.entropy')) | ||
3553 | .sendKeys("0123456789abcdef0123456789abcdef0123456789abcdef"); // 18 words | ||
3554 | driver.executeScript(function() { | ||
3555 | $(".mnemonic-length").val("12").trigger("change"); | ||
3556 | }); | ||
3557 | driver.findElement(By.css(".weak-entropy-override-warning")) | ||
3558 | .getAttribute("class") | ||
3559 | .then(function(classes) { | ||
3560 | expect(classes).toContain("hidden"); | ||
3561 | done(); | ||
3562 | }); | ||
3563 | }); | ||
3564 | |||
3533 | }); | 3565 | }); |