Skip to content

Commit e64e5d0

Browse files
Merge pull request #141 from cl0w5/add_wrapper_tests
Add integration test for wrapper account
2 parents fdd48ef + a07ba43 commit e64e5d0

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

pallets/wrapper/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ pub mod pallet {
281281

282282
impl<T: Config> Pallet<T> {
283283
/// Get the account ID of the pallet
284+
/// Translates to gJpDhAL2bdaamftxXHXTbNxL6EZcXrgSmeLJzn2ficD3n4oWV
284285
pub fn pallet_account_id() -> T::AccountId {
285286
T::PalletId::get().into_account_truncating()
286287
}

pallets/wrapper/src/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl pallet_assets::Config for Test {
111111
}
112112

113113
parameter_types! {
114-
pub const WrapperPalletId: PalletId = PalletId(*b"pwrapper");
114+
pub const WrapperPalletId: PalletId = PalletId(*b"p/wrpper");
115115
pub const LocalTracAssetId: AssetId = 1;
116116
pub const ForeignTracAssetId: AssetId = 2;
117117
}

pallets/wrapper/src/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use super::*;
1515
use crate::mock::*;
1616
use frame_support::{assert_noop, assert_ok};
17+
use sp_core::crypto::Ss58Codec;
1718

1819
#[test]
1920
fn trac_wrap_works() {
@@ -302,7 +303,7 @@ fn cross_user_wrap_operations_work() {
302303
fn pallet_account_id_helper_is_correct() {
303304
new_test_ext().execute_with(|| {
304305
let pallet_account = Wrapper::pallet_account_id();
305-
assert_eq!(pallet_account, 7021806093762588525);
306+
assert_eq!(pallet_account, 8248113402453716845);
306307
});
307308
}
308309

runtime-tests/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg(test)]
22

33
mod assets;
4+
mod wrapper;
45

56
use neuroweb_runtime::{Runtime, System};
67
use sp_runtime::BuildStorage;

runtime-tests/src/wrapper.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![cfg(test)]
2+
3+
use super::new_test_ext;
4+
use neuroweb_runtime::{AccountId, TracWrapperPalletId, Wrapper};
5+
use sp_core::crypto::{Ss58AddressFormat, Ss58Codec};
6+
use sp_runtime::traits::AccountIdConversion;
7+
8+
#[test]
9+
fn wrapper_pallet_account() {
10+
new_test_ext().execute_with(|| {
11+
let wrapper_pallet_account_raw: AccountId = Wrapper::pallet_account_id();
12+
let wrapper_pallet_account_formatted =
13+
wrapper_pallet_account_raw.to_ss58check_with_version(Ss58AddressFormat::custom(101));
14+
15+
assert_eq!(
16+
wrapper_pallet_account_raw,
17+
TracWrapperPalletId::get().into_account_truncating()
18+
);
19+
20+
assert_eq!(
21+
wrapper_pallet_account_formatted,
22+
"gJpDhAL2bdaamftxXHXTbNxL6EZcXrgSmeLJzn2ficD3n4oWV"
23+
);
24+
});
25+
}

0 commit comments

Comments
 (0)