Skip to content

Commit

Permalink
asjustment and new signer test
Browse files Browse the repository at this point in the history
Signed-off-by: Philip-21 <[email protected]>
  • Loading branch information
Philip-21 committed Feb 15, 2024
1 parent b3e1818 commit c7061ab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
7 changes: 1 addition & 6 deletions cmd/deploy_ethereum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ func TestDeployEthereumCmd(t *testing.T) {
}
currDir := t.TempDir()
contractFile := filepath.Join(currDir + "eth_deploy.json")

ethPackage, err := utils.ReadFileToString(contractFile)
if err != nil {
t.Fatalf("Failed to read expected response file: %v", err)
}
Args := []string{"deploy", "ethereum", "stack-2", ethPackage, "param1", "param2"}
Args := []string{"deploy", "ethereum", "stack-2", contractFile, "param1", "param2"}
ethDeployCmd := deployEthereumCmd
ethDeployCmd.SetArgs(Args)
ethDeployCmd.ExecuteContext(ctx)
Expand Down
9 changes: 2 additions & 7 deletions internal/blockchain/ethereum/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import (

func TestReadTruffleCompiledContract(t *testing.T) {
dir := "testdata"
contracFile := filepath.Join(dir, "truffle.json")

contractFile := filepath.Join(dir, "truffle.json")
t.Run("TestTruffleCompilesContract", func(t *testing.T) {
ExpectedContractName := "FireFly_Client"

compiledContracts, err := ReadTruffleCompiledContract(contracFile)
compiledContracts, err := ReadTruffleCompiledContract(contractFile)
if err != nil {
t.Logf("unable to read truffle contract : %v", err)
}
Expand All @@ -31,17 +30,13 @@ func TestReadTruffleCompiledContract(t *testing.T) {
func TestReadSolCompiledContract(t *testing.T) {
dir := "testdata"
contractFile := filepath.Join(dir, "sol.json")

t.Run("TestReadSolContract", func(t *testing.T) {
SolContract, err := ReadSolcCompiledContract(contractFile)
if err != nil {
t.Logf("Unable to read sol contract: %v", err)
}

assert.NotNil(t, SolContract)
contractMap := SolContract.Contracts
assert.NotNil(t, contractMap)

})

}
20 changes: 20 additions & 0 deletions internal/blockchain/ethereum/ethsigner/ethsigner_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package ethsigner

import (
"testing"

"github.com/hyperledger/firefly-cli/pkg/types"
)

func TestWriteSignerConfig(t *testing.T) {
options := &types.InitOptions{ChainID: int64(689)}
stack := &types.Stack{Name: "firefly_eth"}
rpcURL := "http://localhost:9583"
e := EthSignerProvider{
stack: stack,
}
err := e.WriteConfig(options, rpcURL)
if err != nil {
t.Logf("unable to write config :%v", err)
}
}

0 comments on commit c7061ab

Please sign in to comment.