Skip to content

Commit 83ea8f4

Browse files
committed
chore: add test case to confirm group simulate and send matches
1 parent 6134a86 commit 83ea8f4

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

tests/applications/test_app_client.py

+44-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
from algokit_utils.applications.app_spec.arc56 import Arc56Contract, Network
2222
from algokit_utils.errors.logic_error import LogicError
2323
from algokit_utils.models.account import SigningAccount
24-
from algokit_utils.models.amount import AlgoAmount
24+
from algokit_utils.models.amount import AlgoAmount, micro_algo
2525
from algokit_utils.models.state import BoxReference
26-
from algokit_utils.transactions.transaction_composer import AppCreateParams, PaymentParams
26+
from algokit_utils.transactions.transaction_composer import AppCallMethodCallParams, AppCreateParams, PaymentParams
2727

2828

2929
@pytest.fixture
@@ -279,6 +279,48 @@ def test_clone_inheriting_app_name_based_on_default_handling(
279279
assert cloned_app_client.app_name == hello_world_arc32_app_spec.contract.name == app_client.app_name
280280

281281

282+
def test_group_simulate_matches_send(
283+
funded_account: SigningAccount,
284+
test_app_client: AppClient,
285+
) -> None:
286+
app_call1_params = AppCallMethodCallParams(
287+
sender=funded_account.address,
288+
app_id=test_app_client.app_id,
289+
method=algosdk.abi.Method.from_signature("set_global(uint64,uint64,string,byte[4])void"),
290+
args=[1, 2, "asdf", bytes([1, 2, 3, 4])],
291+
)
292+
payment_params = PaymentParams(
293+
sender=funded_account.address, receiver=funded_account.address, amount=micro_algo(10000)
294+
)
295+
app_call2_params = AppCallMethodCallParams(
296+
sender=funded_account.address,
297+
app_id=test_app_client.app_id,
298+
method=algosdk.abi.Method.from_signature("call_abi(string)string"),
299+
args=["test"],
300+
)
301+
302+
simulate_result = (
303+
test_app_client.algorand.new_group()
304+
.add_app_call_method_call(app_call1_params)
305+
.add_payment(payment_params)
306+
.add_app_call_method_call(app_call2_params)
307+
.simulate(skip_signatures=True)
308+
)
309+
310+
send_result = (
311+
test_app_client.algorand.new_group()
312+
.add_app_call_method_call(app_call1_params)
313+
.add_payment(payment_params)
314+
.add_app_call_method_call(app_call2_params)
315+
.send()
316+
)
317+
318+
assert len(simulate_result.transactions) == len(send_result.transactions)
319+
assert len(simulate_result.returns) == len(send_result.returns)
320+
assert simulate_result.returns[0].value == send_result.returns[0].value
321+
assert simulate_result.returns[1].value == send_result.returns[1].value
322+
323+
282324
def test_normalise_app_spec(
283325
raw_hello_world_arc32_app_spec: str,
284326
hello_world_arc32_app_spec: ApplicationSpecification,

0 commit comments

Comments
 (0)