Skip to content

Commit

Permalink
add contract loader test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed May 20, 2024
1 parent 32f4658 commit a5cf6c2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package seth_test

import (
"github.com/ethereum/go-ethereum/common"
link_token "github.com/smartcontractkit/seth/contracts/bind/link"
"testing"

"github.com/smartcontractkit/seth"
Expand Down Expand Up @@ -53,3 +55,17 @@ func TestRPCHealtCheckDisabled_Node_Unhealthy(t *testing.T) {
_, err = seth.NewClientWithConfig(cfg)
require.NoError(t, err, "expected health check to be skipped")
}

func TestContractLoader(t *testing.T) {
c, err := seth.NewClient()
require.NoError(t, err, "failed to initalise seth")

loader := seth.NewContractLoader[link_token.LinkToken](c)

contract, err := loader.LoadContract("LinkToken", TestEnv.LinkTokenContract.Address(), link_token.LinkTokenMetaData.GetAbi, link_token.NewLinkToken)
require.NoError(t, err, "failed to load contract")

owner, err := contract.Owner(c.NewCallOpts())
require.NoError(t, err, "failed to call loaded LINK contract")
require.NotEqual(t, common.Address{}, owner, "expected owner to be set")
}

0 comments on commit a5cf6c2

Please sign in to comment.