mukan-ibc/modules/apps/transfer/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

53 lines
1.2 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/transfer/simulation"
"github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
)
func TestDecodeStore(t *testing.T) {
dec := simulation.NewDecodeStore()
denom := types.NewDenom("uatom", types.NewHop("transfer", "channelToA"))
kvPairs := kv.Pairs{
Pairs: []kv.Pair{
{
Key: types.PortKey,
Value: []byte(types.PortID),
},
{
Key: types.DenomKey,
Value: types.ModuleCdc.MustMarshal(&denom),
},
{
Key: []byte{0x99},
Value: []byte{0x99},
},
},
}
tests := []struct {
name string
expectedLog string
}{
{"PortID", fmt.Sprintf("Port A: %s\nPort B: %s", types.PortID, types.PortID)},
{"Denom", fmt.Sprintf("Denom A: %s\nDenom B: %s", denom.IBCDenom(), denom.IBCDenom())},
{"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)
}
})
}
}