-
Notifications
You must be signed in to change notification settings - Fork 19
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
time-release
mock and unit tests should match runtime configuration
#1861
time-release
mock and unit tests should match runtime configuration
#1861
Conversation
@@ -16,8 +16,8 @@ pub type Schedule<T> = ReleaseSchedule<BlockNumberFor<T>, BalanceOf<T>>; | |||
const SEED: u32 = 0; | |||
|
|||
fn set_balance<T: Config>(who: &T::AccountId, balance: BalanceOf<T>) { | |||
let actual_deposit = T::Currency::mint_into(&who, balance.saturated_into()); | |||
assert_eq!(balance, actual_deposit.unwrap()); | |||
let actual_deposit = T::Currency::set_balance(&who, balance.saturated_into()); |
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.
mint_into
fails when the account has a 0
balance.
set_balance
is infallible and provided by polkadot-sdk specifically for benchmarking and testing.
@@ -15,9 +15,12 @@ | |||
], | |||
// Set the features to use for cargo commands | |||
"rust-analyzer.cargo.features": [ | |||
"frequency-no-relay" | |||
"frequency-no-relay", | |||
"runtime-benchmarks", |
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.
Adding these targets to cover more code, e.g. benchmarking.rs files do not know about any definitions if runtime-benchmarks
is not defined.
2672522
to
a08ed4f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1861 +/- ##
=======================================
Coverage 82.95% 82.95%
=======================================
Files 56 56
Lines 4552 4552
=======================================
Hits 3776 3776
Misses 776 776 ☔ View full report in Codecov by Sentry. |
time-release
mock and unit tests should match runtime configuration
…1836-time-release-pallet-mock-and-unit-test-need-updates
…1836-time-release-pallet-mock-and-unit-test-need-updates
…s' of https://github.com/LibertyDSNP/frequency into 1836-time-release-pallet-mock-and-unit-test-need-updates
3eb3dca
to
3a12faa
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.
Ran unit tests locally; all passed
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 great! 👍
Goal
The goal of this PR is to update the
time-release
mock so the theMinReleaseTransfer
matches the value in the runtime configuration.This may cause follow on failures in some of the unit tests.
Closes #1836
Changes
MinReleaseTransfer
updated to 0.vscode/settings.json
updated to include more targets for better feature coverageHow to Test
time-release
unit tests passChecklist