-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: constrain environment associated type bounds to ease mocking #265
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## frank/extension #265 +/- ##
===================================================
+ Coverage 45.50% 46.23% +0.72%
===================================================
Files 40 40
Lines 3685 3707 +22
Branches 3685 3707 +22
===================================================
+ Hits 1677 1714 +37
+ Misses 1954 1938 -16
- Partials 54 55 +1
|
value.insert(0, version); | ||
value.insert(1, module); | ||
value.insert(2, index); | ||
value.splice(0..0, [version, module, index]); |
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.
Brilliant syntax!
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.
Thats down to Peter! 🙌
The
pallet_contracts::Config
bound on the associated types withinEnvironment
/Ext
means that mocking the environment requires taking a dependency onpallet-contracts
and requires adding it to the mock runtime. This is overkill for unit tests.This PR simply constrains the type bounds to the only type currently required -
AccountId
. This can obviously be refactored in the future as more of theExt
implementation is used.Also adds a test for the
Prepender
, which was the original cause of this refactor requirement.