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

Commit

Permalink
Add a test for schedule_para_initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
pepyakin committed Nov 24, 2021
1 parent 7eb69a5 commit 580a028
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions runtime/parachains/src/paras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,28 @@ mod tests {
ParaPastCodeMeta { upgrade_times: Vec::new(), last_pruned: Some(66) }
);
}

#[test]
fn schedule_para_init_rejects_empty_code() {
new_test_ext(MockGenesisConfig::default()).execute_with(||{
assert_err!(
Paras::schedule_para_initialize(1000.into(), ParaGenesisArgs {
parachain: false,
genesis_head: Default::default(),
validation_code: ValidationCode(vec![]),
}),
Error::<Test>::CannotOnboard,
);

assert_ok!(
Paras::schedule_para_initialize(1000.into(), ParaGenesisArgs {
parachain: false,
genesis_head: Default::default(),
validation_code: ValidationCode(vec![1]),
})
);
});
}

#[test]
fn para_past_code_pruning_in_initialize() {
Expand Down

0 comments on commit 580a028

Please sign in to comment.