-
-
Notifications
You must be signed in to change notification settings - Fork 126
Increase unit test coverage #309
Conversation
b3cec81 to
aa1c9ac
Compare
Gudahtt
left a comment
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.
LGTM!
7cbeaa2 to
9af8d18
Compare
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* feat: add UserOperation methods * build: ignore errors from Snap packages * fix: fix return type of `prepareUserOperation` * chore: enable lcov coverage * test: add missing unit tests * chore: update `yarn.lock` * chore: apply linter * chore: update @metamask/keyring-api version to 2.0.0
e690c7e to
6fcb2c3
Compare
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.
Looks good, thanks for doing this. All of my comments are minor, but it might be nice to be a bit more descriptive with the test names.
| }); | ||
|
|
||
| describe('signMessage', () => { | ||
| it('should sign message', async () => { |
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.
Can we go into a little more detail on what the expected behavior here is? What does "signing" mean? It looks like the input data is encrypted using the seed phrase? Does signMessage on the keyring do most of the work? If so, it might be important to highlight the keyring being used in this test, since the exact keyring being used affects the signing.
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.
The data is usually a digest of the message encoded as hex (so it is not encrypted, just hashed with keccak256), ready to be signed with an ecdsa private key, that in our case is handled by the Keyring linked to the from account.
So, the target Keyring must indeed support the signMessage method, and the "real work" is done by it.
Because of this, I would be inclined to change it to forwards the message to the keyring for signing (using signTransaction tests as an example) - but on the other hand this test case doesn't only check if the message gets forwarded to the Keyring: it also checks for the signature correctness, and this is the reason why we use a seed phrase with a known and predictable first-account-address
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.
Gotcha, yeah that's a bit tricky. Okay, perhaps we can think of a better name later.
Description
This PR increases the unit test coverage of the controller.
Current change:
Changes
n/a
References
n/a
Checklist