Skip to content

Commit

Permalink
fix: remove impossible test; parsing issue; and check for a contract_id
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Sep 11, 2023
1 parent e55c621 commit 4ae9a0e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmd/soroban-rpc/internal/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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"]`)
Expand Down

0 comments on commit 4ae9a0e

Please sign in to comment.