Skip to content

Commit ea09ee7

Browse files
Add docs for tests
1 parent 7c7f031 commit ea09ee7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • crates/pallet-balanced-currency-swap-bridges-initializer/src

crates/pallet-balanced-currency-swap-bridges-initializer/src/tests.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use crate::{
88
swappable_balance, InitializerVersion, CURRENT_BRIDGES_INITIALIZER_VERSION,
99
};
1010

11+
/// This test verifies that balanced bridges initialization works in case bridges pot accounts
12+
/// have been created with existential deposit balances respectively at genesis.
1113
#[test]
1214
fn initialization_bridges_ed_works() {
1315
with_runtime_lock(|| {
@@ -82,6 +84,8 @@ fn initialization_bridges_ed_works() {
8284
})
8385
}
8486

87+
/// This test verifies that balanced bridges initialization works in case bridges pot accounts
88+
/// have been created with existential deposit balances plus some delta respectively at genesis.
8589
#[test]
8690
fn initialization_bridges_ed_delta_works() {
8791
with_runtime_lock(|| {
@@ -158,6 +162,8 @@ fn initialization_bridges_ed_delta_works() {
158162
})
159163
}
160164

165+
/// This test verifies idempotency of balanced bridges initialization algorithm by changing
166+
/// balances state and applying initialization operation several times.
161167
#[test]
162168
fn initialization_idempotency() {
163169
with_runtime_lock(|| {
@@ -253,6 +259,8 @@ fn initialization_idempotency() {
253259
})
254260
}
255261

262+
/// This test verifies that balanced bridges initialization works in case genesis configuration
263+
/// provides evm swappable balance to be 0.
256264
#[test]
257265
fn initialization_evm_swappable_zero() {
258266
with_runtime_lock(|| {
@@ -308,6 +316,8 @@ fn initialization_evm_swappable_zero() {
308316
})
309317
}
310318

319+
/// This test verifies that balanced bridges initialization fails in case genesis configuration
320+
/// contains native treasury account with insufficient balance to properly perform initialization.
311321
#[test]
312322
#[should_panic = "error during bridges initialization: Module(ModuleError { index: 1, error: [2, 0, 0, 0], message: Some(\"InsufficientBalance\") })"]
313323
fn initialization_fails_treasury_insufficient_balance() {
@@ -352,6 +362,11 @@ fn initialization_fails_treasury_insufficient_balance() {
352362
})
353363
}
354364

365+
/// This test simulates runtime upgrade operation by using different mocked runtime versions and
366+
/// verifies that balanced bridges initialization works as expected for `on_runtime_upgrade` call.
367+
///
368+
/// - v0: just contains native and evm balances.
369+
/// - v1: v0 with bridges initialization logic.
355370
#[test]
356371
fn runtime_upgrade() {
357372
with_runtime_lock(|| {

0 commit comments

Comments
 (0)