mukan-ibc/modules/apps/27-interchain-accounts/simulation/decoder_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

64 lines
1.6 KiB
Go

package simulation_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/types/kv"
"github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/simulation"
"github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/types"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
func TestDecodeStore(t *testing.T) {
var (
owner = "owner"
channelID = ibctesting.FirstChannelID
)
dec := simulation.NewDecodeStore()
kvPairs := kv.Pairs{
Pairs: []kv.Pair{
{
Key: []byte(types.PortKeyPrefix),
Value: []byte(types.HostPortID),
},
{
Key: []byte(types.OwnerKeyPrefix),
Value: []byte("owner"),
},
{
Key: []byte(types.ActiveChannelKeyPrefix),
Value: []byte("channel-0"),
},
{
Key: []byte(types.IsMiddlewareEnabledPrefix),
Value: []byte("false"),
},
},
}
tests := []struct {
name string
expectedLog string
}{
{"PortID", fmt.Sprintf("Port A: %s\nPort B: %s", types.HostPortID, types.HostPortID)},
{"Owner", fmt.Sprintf("Owner A: %s\nOwner B: %s", owner, owner)},
{"ActiveChannel", fmt.Sprintf("ActiveChannel A: %s\nActiveChannel B: %s", channelID, channelID)},
{"IsMiddlewareEnabled", fmt.Sprintf("IsMiddlewareEnabled A: %s\nIsMiddlewareEnabled B: %s", "false", "false")},
{"other", ""},
}
for i, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if i == len(tests)-1 {
require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name)
} else {
require.Equal(t, tt.expectedLog, dec(kvPairs.Pairs[i], kvPairs.Pairs[i]), tt.name)
}
})
}
}