mukan-ibc/modules/light-clients/07-tendermint/codec_test.go
Mukan Erkin Törük 6852832fe8
Some checks failed
CodeQL / Analyze (push) Waiting to run
Docker Build & Push Simapp (main) / docker-build (push) Waiting to run
golangci-lint / lint (push) Waiting to run
Tests / Code Coverage / build (amd64) (push) Waiting to run
Tests / Code Coverage / build (arm64) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[additional-args:-tags="test_e2e" name:e2e path:./e2e]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:08-wasm path:./modules/light-clients/08-wasm]) (push) Waiting to run
Tests / Code Coverage / unit-tests (map[name:ibc-go path:.]) (push) Waiting to run
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
Buf-Push / push (push) Has been cancelled
initial: sovereign Mukan Network fork
2026-05-11 03:18:28 +03:00

62 lines
1.3 KiB
Go

package tendermint_test
import (
"errors"
"testing"
"github.com/stretchr/testify/require"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
tendermint "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
)
func TestCodecTypeRegistration(t *testing.T) {
testCases := []struct {
name string
typeURL string
expError error
}{
{
"success: ClientState",
sdk.MsgTypeURL(&tendermint.ClientState{}),
nil,
},
{
"success: ConsensusState",
sdk.MsgTypeURL(&tendermint.ConsensusState{}),
nil,
},
{
"success: Header",
sdk.MsgTypeURL(&tendermint.Header{}),
nil,
},
{
"success: Misbehaviour",
sdk.MsgTypeURL(&tendermint.Misbehaviour{}),
nil,
},
{
"type not registered on codec",
"ibc.invalid.MsgTypeURL",
errors.New("unable to resolve type URL ibc.invalid.MsgTypeURL"),
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
encodingCfg := moduletestutil.MakeTestEncodingConfig(tendermint.AppModuleBasic{})
msg, err := encodingCfg.Codec.InterfaceRegistry().Resolve(tc.typeURL)
if tc.expError == nil {
require.NotNil(t, msg)
require.NoError(t, err)
} else {
require.Nil(t, msg)
require.ErrorContains(t, err, tc.expError.Error())
}
})
}
}