Skip to content

Commit

Permalink
fix: add test to see if contract can be deployed after hash has expired
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Sep 11, 2023
1 parent c31d216 commit f5413e7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/soroban-rpc/internal/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"strings"
"testing"
"time"

"github.com/creachadair/jrpc2"
"github.com/creachadair/jrpc2/jhttp"
Expand Down Expand Up @@ -38,6 +39,18 @@ func TestCLIContractInstallAndDeploy(t *testing.T) {
isValidContractID(t, last)
}

func TestCLIContractInstallAndDeployAfterExpiration(t *testing.T) {
NewCLITest(t)
runSuccessfulCLICmd(t, "contract install --wasm "+helloWorldContractPath)
time.Sleep(time.Second * 20)
wasm := getHelloWorldContract(t)
contractHash := xdr.Hash(sha256.Sum256(wasm))
output := runSuccessfulCLICmd(t, fmt.Sprintf("contract deploy --salt 0 --wasm-hash %s", contractHash.HexString()))
lines := filterSlice(strings.Split(output, "\n"), nonEmpty)
last := lines[len(lines)-1]
isValidContractID(t, last)
}

func nonEmpty(s string) bool {
return s != ""
}
Expand Down

0 comments on commit f5413e7

Please sign in to comment.