diff options
author | Ian Coleman <ian@iancoleman.io> | 2019-11-11 10:53:20 +1100 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2019-11-11 10:53:20 +1100 |
commit | a04946e23e479fd09f89eb2b2f541c38ebd62799 (patch) | |
tree | 9cf24d898cedff250fb40142ee31e60b43072204 /tests | |
parent | 700294714c39cb6e8226b960671a33dc93362edc (diff) | |
download | BIP39-a04946e23e479fd09f89eb2b2f541c38ebd62799.tar.gz BIP39-a04946e23e479fd09f89eb2b2f541c38ebd62799.tar.zst BIP39-a04946e23e479fd09f89eb2b2f541c38ebd62799.zip |
Add test for Pull Request 279 split phrase cards
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spec/tests.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 07918c2..0ddbdba 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -4140,4 +4140,35 @@ fit('Converts mnemonics into raw entropy', function(done) { | |||
4140 | }); | 4140 | }); |
4141 | }); | 4141 | }); |
4142 | 4142 | ||
4143 | // Pull Request 279 | ||
4144 | // Added Split Phrase Card Output | ||
4145 | fit('Shows split prase cards', function(done) { | ||
4146 | var originalPhrase = "ugly charge strong giant once anchor capable october thumb inject dwarf legal alley mixture shoot"; | ||
4147 | var originalWords = originalPhrase.split(' '); | ||
4148 | driver.findElement(By.css('.phrase')) | ||
4149 | .sendKeys(originalPhrase); | ||
4150 | driver.sleep(generateDelay).then(function() { | ||
4151 | driver.findElement(By.css('.phraseSplit')) | ||
4152 | .getAttribute("value") | ||
4153 | .then(function(cardsStr) { | ||
4154 | var cards = cardsStr.split("\n"); | ||
4155 | expect(cards.length).toBe(3); | ||
4156 | // test all 2-of-3 combos can be used to form full phrase | ||
4157 | var combos = [[0,1],[0,2],[1,2]]; | ||
4158 | for (var i=0; i<combos.length; i++) { | ||
4159 | var combo = combos[i]; | ||
4160 | var a = combo[0]; | ||
4161 | var b = combo[1]; | ||
4162 | var phrase = cards[a] + " " + cards[b]; | ||
4163 | // check all original words are present | ||
4164 | for (var j=0; j<originalWords.length; j++) { | ||
4165 | var originalWord = originalWords[j]; | ||
4166 | expect(phrase).toContain(originalWord); | ||
4167 | } | ||
4168 | } | ||
4169 | done(); | ||
4170 | }); | ||
4171 | }); | ||
4172 | }); | ||
4173 | |||
4143 | }); | 4174 | }); |