-
Notifications
You must be signed in to change notification settings - Fork 30
Display warning for passphrase format - Closes #337 #644
Conversation
src/utils/input/index.js
Outdated
error => error.code !== 'INVALID_MNEMONIC', | ||
); | ||
uniquePassphraseErrors.forEach(error => | ||
console.info(`Warning: ${error.message}`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer not using the console
Validate right before executing the command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean return back the errors from the utils and handle it with this.print
in each command?
src/utils/input/index.js
Outdated
@@ -13,6 +13,7 @@ | |||
* Removal or modification of this copyright notice is prohibited. | |||
* | |||
*/ | |||
import * as elements from 'lisk-elements'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think u can destruct here or not use *
src/utils/input/index.js
Outdated
const errors = passphraseModule.validation | ||
.getPassphraseValidationErrors(input) | ||
.filter(error => error.message); | ||
if (accumulator.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this length check?
test/utils/input/index.js
Outdated
passphrase: stdin, | ||
}); | ||
await getInputsFromSources(inputs); | ||
expect(console.warn.getCall(0).args[0].trim()).to.equal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calledWith
doesn't work here?
What was the problem?
No warning when user inputs invalid mnemonic for passphrase.
How did I fix it?
Modified
getInputsFromSources
to fetch warnings from elements.How to test it?
Enter invalid mnemonic passphrase for any command that requires passphrase input.
Review checklist