2020-08-27 02:05:27 +00:00
|
|
|
package v0_11
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
|
|
|
|
"github.com/kava-labs/kava/app"
|
|
|
|
v0_9bep3 "github.com/kava-labs/kava/x/bep3/legacy/v0_9"
|
2020-09-30 18:33:48 +00:00
|
|
|
v0_9pricefeed "github.com/kava-labs/kava/x/pricefeed/legacy/v0_9"
|
2020-08-27 02:05:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMain(m *testing.M) {
|
|
|
|
config := sdk.GetConfig()
|
|
|
|
app.SetBech32AddressPrefixes(config)
|
|
|
|
app.SetBip44CoinType(config)
|
|
|
|
|
|
|
|
os.Exit(m.Run())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMigrateBep3(t *testing.T) {
|
|
|
|
bz, err := ioutil.ReadFile(filepath.Join("testdata", "bep3-v09.json"))
|
|
|
|
require.NoError(t, err)
|
|
|
|
var oldGenState v0_9bep3.GenesisState
|
|
|
|
cdc := app.MakeCodec()
|
|
|
|
require.NotPanics(t, func() {
|
|
|
|
cdc.MustUnmarshalJSON(bz, &oldGenState)
|
|
|
|
})
|
|
|
|
|
|
|
|
newGenState := MigrateBep3(oldGenState)
|
|
|
|
err = newGenState.Validate()
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|
2020-09-30 18:33:48 +00:00
|
|
|
|
|
|
|
func TestMigratePricefeed(t *testing.T) {
|
|
|
|
bz, err := ioutil.ReadFile(filepath.Join("testdata", "pricefeed-v09.json"))
|
|
|
|
require.NoError(t, err)
|
|
|
|
var oldGenState v0_9pricefeed.GenesisState
|
|
|
|
cdc := app.MakeCodec()
|
|
|
|
require.NotPanics(t, func() {
|
|
|
|
cdc.MustUnmarshalJSON(bz, &oldGenState)
|
|
|
|
})
|
|
|
|
newGenState := MigratePricefeed(oldGenState)
|
|
|
|
err = newGenState.Validate()
|
|
|
|
require.NoError(t, err)
|
|
|
|
}
|