Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add batch call test example
  • Loading branch information
paulormart committed Oct 15, 2021
commit a57233a779ce806b59084401deb7a228d78ec503
40 changes: 33 additions & 7 deletions tests/src/frame/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.

use crate::{
node_runtime::system,
test_context,
TestRuntime,
node_runtime::runtime_types::frame_system::pallet::Call,
node_runtime::runtime_types::node_runtime::Call::System, node_runtime::system,
node_runtime::utility, test_context, TestRuntime,
};
use assert_matches::assert_matches;
use sp_keyring::AccountKeyring;
use subxt::extrinsic::{
PairSigner,
Signer,
};
use subxt::extrinsic::{PairSigner, Signer};

#[async_std::test]
async fn storage_account() {
Expand Down Expand Up @@ -57,3 +54,32 @@ async fn tx_remark_with_event() {
let remarked = result.find_event::<system::events::Remarked>();
assert_matches!(remarked, Ok(Some(_)));
}

#[async_std::test]
async fn tx_batch_remarks() {
let alice = PairSigner::<TestRuntime, _>::new(AccountKeyring::Alice.pair());
let cxt = test_context().await;

let remark_a = Call::remark {
remark: b"cool remark".to_vec(),
};
let remark_b = Call::remark {
remark: b"awesome remark".to_vec(),
};

let call_a = System(remark_a);

let call_b = System(remark_b);

let result = cxt
.api
.tx()
.utility()
.batch(vec![call_a, call_b])
.sign_and_submit_then_watch(&alice)
.await
.unwrap();

let batch_completed = result.find_event::<utility::events::BatchCompleted>();
assert_matches!(batch_completed, Ok(Some(_)));
}