Skip to content
Snippets Groups Projects
Commit 83542d27 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

test: refund queue

parent 34df414c
No related branches found
No related tags found
No related merge requests found
Pipeline #33566 waiting for manual action
......@@ -96,7 +96,7 @@ pub mod pallet {
pub type PendingNewAccounts<T: Config> =
StorageMap<_, Blake2_128Concat, T::AccountId, (), OptionQuery>;
#[derive(Encode, Decode, Clone, TypeInfo)]
#[derive(Encode, Decode, Clone, TypeInfo, Debug, PartialEq)]
pub struct QueuedRefund<AccountId, IdtyId, Balance> {
/// account to refund
pub account: AccountId,
......
......@@ -954,6 +954,7 @@ fn test_validate_new_idty_after_few_uds() {
IdtyData {
// first eligible UD will be at block 30
first_eligible_ud: pallet_universal_dividend::FirstEligibleUd::from(3),
quotas: (0, 0)
}
);
});
......@@ -1014,6 +1015,7 @@ fn test_claim_memberhsip_after_few_uds() {
IdtyData {
// first eligible UD will be at block 30
first_eligible_ud: pallet_universal_dividend::FirstEligibleUd::from(3),
quotas: (0, 0)
}
);
});
......
......@@ -100,3 +100,36 @@ fn test_transfer_xt() {
assert_eq!(Balances::free_balance(Treasury::account_id()), 200 + 3);
})
}
/// test that fees are added to the refund queue
#[test]
fn test_refund_queue() {
ExtBuilder::new(1, 3, 4)
.with_initial_balances(vec![
(AccountKeyring::Alice.to_account_id(), 10_000),
(AccountKeyring::Eve.to_account_id(), 10_000),
])
.build()
.execute_with(|| {
let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: AccountKeyring::Eve.to_account_id().into(),
value: 500,
});
// 1 cĞD of tip
let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 1u64);
assert_ok!(Executive::apply_extrinsic(xt));
// check treasury initial amount
assert_eq!(
pallet_duniter_account::RefundQueue::<Runtime>::get()
.first()
.expect("a refund should have been added to the queue"),
&pallet_duniter_account::pallet::QueuedRefund {
account: AccountKeyring::Alice.to_account_id(),
identity: 1u32,
amount: 2u64
}
);
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment