mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package e2e
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/strangelove-ventures/interchaintest/v8"
|
|
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
|
"github.com/stretchr/testify/require"
|
|
"go.uber.org/zap/zaptest"
|
|
)
|
|
|
|
func TestBasicChain(t *testing.T) {
|
|
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
|
|
&DefaultChainSpec,
|
|
})
|
|
|
|
chains, err := cf.Chains(t.Name())
|
|
require.NoError(t, err)
|
|
|
|
chain := chains[0].(*cosmos.CosmosChain)
|
|
|
|
ic := interchaintest.NewInterchain().
|
|
AddChain(chain)
|
|
|
|
ctx := context.Background()
|
|
client, network := interchaintest.DockerSetup(t)
|
|
|
|
require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{
|
|
TestName: t.Name(),
|
|
Client: client,
|
|
NetworkID: network,
|
|
SkipPathCreation: true,
|
|
}))
|
|
t.Cleanup(func() {
|
|
_ = ic.Close()
|
|
})
|
|
|
|
// faucet funds to the user
|
|
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", GenesisFundsAmount, chain)
|
|
user := users[0]
|
|
|
|
// balance check
|
|
balance, err := chain.GetBalance(ctx, user.FormattedAddress(), Denom)
|
|
require.NoError(t, err)
|
|
require.True(t, balance.Equal(GenesisFundsAmount), "user balance should be equal to genesis funds")
|
|
}
|