Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gui1117 committed Feb 21, 2020
1 parent 8c5642f commit 435409c
Show file tree
Hide file tree
Showing 4 changed files with 4,688 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/common/src/attestations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ impl<T: staking::Trait> RewardAttestation for staking::Module<T> {
// https://research.web3.foundation/en/latest/polkadot/Token%20Economics/#payment-details
const STAKING_REWARD_POINTS: u32 = 20;

Self::reward_by_indices(validator_indices.into_iter().map(|i| (i, STAKING_REWARD_POINTS)))
// NOTE: remove for this test branch
// Self::reward_by_indices(validator_indices.into_iter().map(|i| (i, STAKING_REWARD_POINTS)))
}
}

Expand Down
3 changes: 3 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit="256"]

#[cfg(test)]
mod tests;

use rstd::prelude::*;
use sp_core::u32_trait::{_1, _2, _3, _4, _5};
use codec::{Encode, Decode};
Expand Down
14 changes: 14 additions & 0 deletions runtime/kusama/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
mod test_upgrade_from_kusama_dataset;

// Test that an upgrade from previous test environment works.
#[test]
fn test_upgrade_staking_works() {
let mut storage = sp_runtime::Storage::default();
for (key, value) in test_upgrade_from_kusama_dataset::KUSAMA.iter() {
storage.top.insert(key.to_vec(), value.to_vec());
}
let mut ext = sp_io::TestExternalities::from(storage);
ext.execute_with(|| {
super::Staking::test_do_upgrade();
});
}
Loading

0 comments on commit 435409c

Please sign in to comment.