Skip to content

Commit

Permalink
fix: add valid contract func
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Sep 11, 2023
1 parent 4ae9a0e commit 792844b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/soroban-rpc/internal/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,23 @@ 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()))
println(string(output))
lines := strings.Split(output, "\n")
last := lines[len(lines)-1]
require.Len(t, last, 56)
require.Regexp(t, "^C", last)
isValidContractID(t, last)
}

func isValidContractID(t *testing.T, contractID string) {
require.Len(t, contractID, 56)
require.Regexp(t, "^C", contractID)
}

func TestCLIContractDeploy(t *testing.T) {
NewCLITest(t)
output := runSuccessfulCLICmd(t, "contract deploy --salt 0 --wasm "+helloWorldContractPath)
require.Contains(t, output, "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM")
lines := strings.Split(output, "\n")
last := lines[len(lines)-1]
isValidContractID(t, last)
}

func TestCLIContractDeployAndInvoke(t *testing.T) {
Expand Down

0 comments on commit 792844b

Please sign in to comment.