Skip to content

Commit

Permalink
scenario step default expect ok
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-marinica committed Jul 14, 2023
1 parent 9c780a0 commit d687132
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ fn adder_scenario_constructed_raw() {
ScDeployStep::new()
.from(owner_address)
.code(adder_code)
.call(adder_contract.init(5u32))
.expect(TxExpect::ok().no_result()),
.call(adder_contract.init(5u32)),
|new_address, _: TypedResponse<()>| {
assert_eq!(new_address, adder_contract.to_address());
},
Expand All @@ -46,8 +45,7 @@ fn adder_scenario_constructed_raw() {
ScCallStep::new()
.from(owner_address)
.to(&adder_contract)
.call(adder_contract.add(3u32))
.expect(TxExpect::ok().no_result()),
.call(adder_contract.add(3u32)),
)
.check_state_step(
CheckStateStep::new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ fn crowdfunding_scenario_rust_test() {
2_000u32,
deadline,
EgldOrEsdtTokenIdentifier::esdt(cf_token_id_value),
))
.expect(TxExpect::ok().no_result()),
)),
);

// setup user accounts
Expand All @@ -63,8 +62,7 @@ fn crowdfunding_scenario_rust_test() {
.from(first_user_addr)
.to(&cf_sc)
.esdt_transfer(cf_token_id, 0u64, 1_000u64)
.call(cf_sc.fund())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.fund()),
)
.check_state_step(
CheckStateStep::new()
Expand All @@ -85,8 +83,7 @@ fn crowdfunding_scenario_rust_test() {
.from(second_user_addr)
.to(&cf_sc)
.esdt_transfer(cf_token_id, 0u64, 500u64)
.call(cf_sc.fund())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.fund()),
)
.check_state_step(
CheckStateStep::new()
Expand Down Expand Up @@ -127,8 +124,7 @@ fn crowdfunding_scenario_rust_test() {
ScCallStep::new()
.from(owner_addr)
.to(&cf_sc)
.call(cf_sc.claim())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.claim()),
)
.check_state_step(
CheckStateStep::new()
Expand All @@ -148,8 +144,7 @@ fn crowdfunding_scenario_rust_test() {
ScCallStep::new()
.from(first_user_addr)
.to(&cf_sc)
.call(cf_sc.claim())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.claim()),
)
.check_state_step(
CheckStateStep::new()
Expand All @@ -169,8 +164,7 @@ fn crowdfunding_scenario_rust_test() {
ScCallStep::new()
.from(second_user_addr)
.to(&cf_sc)
.call(cf_sc.claim())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.claim()),
)
.check_state_step(
CheckStateStep::new()
Expand All @@ -191,8 +185,7 @@ fn crowdfunding_scenario_rust_test() {
.from(first_user_addr)
.to(&cf_sc)
.esdt_transfer(cf_token_id, 0u64, 1_000u64)
.call(cf_sc.fund())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.fund()),
);

// second user deposit
Expand All @@ -201,8 +194,7 @@ fn crowdfunding_scenario_rust_test() {
.from(second_user_addr)
.to(&cf_sc)
.esdt_transfer(cf_token_id, 0u64, 1_000u64)
.call(cf_sc.fund())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.fund()),
);

let status: Status = cf_sc
Expand Down Expand Up @@ -239,8 +231,7 @@ fn crowdfunding_scenario_rust_test() {
ScCallStep::new()
.from(owner_addr)
.to(&cf_sc)
.call(cf_sc.claim())
.expect(TxExpect::ok().no_result()),
.call(cf_sc.claim()),
)
.check_state_step(
CheckStateStep::new()
Expand Down
9 changes: 3 additions & 6 deletions contracts/examples/multisig/tests/multisig_rust_test_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ impl MultisigTestState {
ScDeployStep::new()
.from(self.owner.clone())
.code(self.world.code_expression(MULTISIG_PATH_EXPR))
.call(self.multisig.init(2u32, board))
.expect(TxExpect::ok().no_result()),
.call(self.multisig.init(2u32, board)),
);

self
Expand All @@ -156,8 +155,7 @@ impl MultisigTestState {
ScDeployStep::new()
.from(self.owner.clone())
.code(self.world.code_expression(ADDER_PATH_EXPR))
.call(self.adder.init(0u64))
.expect(TxExpect::ok().no_result()),
.call(self.adder.init(0u64)),
);

self
Expand All @@ -167,8 +165,7 @@ impl MultisigTestState {
self.world.sc_call_step(
ScCallStep::new()
.from(signer)
.call(self.multisig.sign(action_id))
.expect(TxExpect::ok().no_result()),
.call(self.multisig.sign(action_id)),
);
}

Expand Down

0 comments on commit d687132

Please sign in to comment.