Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e tests folder restructure #14

Merged
merged 13 commits into from
Jun 20, 2024
241 changes: 121 additions & 120 deletions e2e/adversarial_test.go

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions e2e/basic_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package e2e

import (
"encoding/json"
"testing"

wasmibctesting "github.com/CosmWasm/wasmd/x/wasm/ibctesting"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/public-awesome/ics721/e2e/test_suite"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)

type BasicTestSuite struct {
suite.Suite

coordinator *wasmibctesting.Coordinator

// testing chains used for convenience and readability
chainA *wasmibctesting.TestChain

chainABridge sdk.AccAddress
}

func TestBasic(t *testing.T) {
suite.Run(t, new(BasicTestSuite))
}

func (suite *BasicTestSuite) SetupTest() {
suite.coordinator = wasmibctesting.NewCoordinator(suite.T(), 2)
suite.chainA = suite.coordinator.GetChain(wasmibctesting.GetChainID(0))
}

func (suite *BasicTestSuite) TestStoreCodes() {
// Store the ICS721 contract.
chainAStoreResp := suite.chainA.StoreCodeFile("../artifacts/ics721_base.wasm")
require.Equal(suite.T(), uint64(1), chainAStoreResp.CodeID)

// Store the cw721 contract.
chainAStoreResp = suite.chainA.StoreCodeFile("../external-wasms/cw721_base_v0.18.0.wasm")
require.Equal(suite.T(), uint64(2), chainAStoreResp.CodeID)
}

func (suite *BasicTestSuite) TestInstantiateIcs721() {
// Store the ICS721 contract.
chainAStoreResp := suite.chainA.StoreCodeFile("../artifacts/ics721_base.wasm")
require.Equal(suite.T(), uint64(1), chainAStoreResp.CodeID)

// Instantiate the ICS721 contract.
instantiateICS721 := test_suite.InstantiateICS721Bridge{
CW721CodeID: 1,
// no pauser nor proxy by default.
OutgoingProxy: nil,
IncomingProxy: nil,
Pauser: nil,
}
instantiateICS721Raw, err := json.Marshal(instantiateICS721)
require.NoError(suite.T(), err)
suite.chainABridge = suite.chainA.InstantiateContract(1, instantiateICS721Raw)
}
Loading
Loading