From 66f290326dae6cad0a625bbfe7c76a593b24fa66 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Fri, 15 Sep 2023 14:36:30 -0400 Subject: [PATCH] chore: add wrap test to show contract is created successfully --- cmd/soroban-rpc/internal/test/cli_test.go | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cmd/soroban-rpc/internal/test/cli_test.go b/cmd/soroban-rpc/internal/test/cli_test.go index 3980b6b73b..3cf24e51f7 100644 --- a/cmd/soroban-rpc/internal/test/cli_test.go +++ b/cmd/soroban-rpc/internal/test/cli_test.go @@ -34,15 +34,12 @@ func cargoTest(t *testing.T, name string) { func TestCLIfetch(t *testing.T) { cargoTest(t, "contract_sandbox::fetch") } - func TestCLIcontract_data_read_failure(t *testing.T) { cargoTest(t, "contract_sandbox::contract_data_read_failure") } - func TestCLIinvoke_auth(t *testing.T) { cargoTest(t, "contract_sandbox::invoke_auth") } - func TestCLIcontract_data_read(t *testing.T) { cargoTest(t, "contract_sandbox::contract_data_read") } @@ -55,9 +52,6 @@ func TestCLIinvoke_hello_world_from_file_fail(t *testing.T) { func TestCLIinvoke_hello_world_with_lib_two(t *testing.T) { cargoTest(t, "contract_sandbox::invoke_hello_world_with_lib_two") } -func TestCLIinvoke_hello_world_with_lib(t *testing.T) { - cargoTest(t, "contract_sandbox::invoke_hello_world_with_lib") -} func TestCLIinvoke_hello_world_with_seed(t *testing.T) { cargoTest(t, "contract_sandbox::invoke_hello_world_with_seed") } @@ -74,6 +68,24 @@ func TestCLIinvoke_with_seed(t *testing.T) { cargoTest(t, "contract_sandbox::invoke_with_seed") } +func TestCLIWrapCustom(t *testing.T) { + NewCLITest(t) + testAccount := getCLIDefaultAccount(t) + strkeyContractID := runSuccessfulCLICmd(t, fmt.Sprintf("lab token wrap --asset=deadbeef:%s", testAccount)) + require.Equal(t, "true", runSuccessfulCLICmd(t, fmt.Sprintf("contract invoke --id=%s -- authorized --id=%s", strkeyContractID, testAccount))) + // require.Equal(t, "CAMTHSPKXZJIRTUXQP5QWJIFH3XIDMKLFAWVQOFOXPTKAW5GKV37ZC4N", strkeyContractID) + runSuccessfulCLICmd(t, fmt.Sprintf("contract invoke --id=%s -- mint --to=%s --amount 1", strkeyContractID, testAccount)) +} + +func TestCLIWrapNative(t *testing.T) { + NewCLITest(t) + testAccount := getCLIDefaultAccount(t) + strkeyContractID := runSuccessfulCLICmd(t, fmt.Sprintf("lab token wrap --asset=native:%s", testAccount)) + require.Equal(t, "CAMTHSPKXZJIRTUXQP5QWJIFH3XIDMKLFAWVQOFOXPTKAW5GKV37ZC4N", strkeyContractID) + require.Equal(t, "true", runSuccessfulCLICmd(t, fmt.Sprintf("contract invoke --id=%s -- authorized --id=%s", strkeyContractID, testAccount))) + require.Equal(t, "\"9223372036854775807\"", runSuccessfulCLICmd(t, fmt.Sprintf("contract invoke --id=%s -- balance --id %s", strkeyContractID, testAccount))) +} + func TestCLIContractInstall(t *testing.T) { NewCLITest(t) output := runSuccessfulCLICmd(t, "contract install --wasm "+helloWorldContractPath)