From 4ae9a0e07db677a64015d92c3d16867bfd83c8ec Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Mon, 11 Sep 2023 11:22:04 -0400 Subject: [PATCH] fix: remove impossible test; parsing issue; and check for a contract_id --- cmd/soroban-rpc/internal/test/cli_test.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cmd/soroban-rpc/internal/test/cli_test.go b/cmd/soroban-rpc/internal/test/cli_test.go index 9359c174d..5d3a593f8 100644 --- a/cmd/soroban-rpc/internal/test/cli_test.go +++ b/cmd/soroban-rpc/internal/test/cli_test.go @@ -31,7 +31,10 @@ func TestCLIContractInstallAndDeploy(t *testing.T) { wasm := getHelloWorldContract(t) contractHash := xdr.Hash(sha256.Sum256(wasm)) output := runSuccessfulCLICmd(t, fmt.Sprintf("contract deploy --salt 0 --wasm-hash %s", contractHash.HexString())) - require.Contains(t, output, "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM") + lines := strings.Split(output, "\n") + last := lines[len(lines)-1] + require.Len(t, last, 56) + require.Regexp(t, "^C", last) } func TestCLIContractDeploy(t *testing.T) { @@ -40,15 +43,9 @@ func TestCLIContractDeploy(t *testing.T) { require.Contains(t, output, "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM") } -func TestCLIContractInvokeWithWasm(t *testing.T) { - NewCLITest(t) - output := runSuccessfulCLICmd(t, fmt.Sprintf("contract invoke --salt=0 --wasm %s -- hello --world=world", helloWorldContractPath)) - require.Contains(t, output, `["Hello","world"]`) -} - func TestCLIContractDeployAndInvoke(t *testing.T) { NewCLITest(t) - output := runSuccessfulCLICmd(t, "contract deploy --id 1 --wasm "+helloWorldContractPath) + output := runSuccessfulCLICmd(t, "contract deploy --salt=0 --wasm "+helloWorldContractPath) contractID := strings.TrimSpace(output) output = runSuccessfulCLICmd(t, fmt.Sprintf("contract invoke --id %s -- hello --world=world", contractID)) require.Contains(t, output, `["Hello","world"]`)