Some checks failed
CodeQL / Analyze (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
Docker Build & Push Simapp (main) / docker-build (push) Has been cancelled
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
package simulation_test
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"git.cw.tr/mukan-network/mukan-sdk/types/kv"
|
|
|
|
"git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/simulation"
|
|
"git.cw.tr/mukan-network/mukan-ibc/modules/apps/27-interchain-accounts/types"
|
|
ibctesting "git.cw.tr/mukan-network/mukan-ibc/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)
|
|
}
|
|
})
|
|
}
|
|
}
|