Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
codehans committed Oct 25, 2023
1 parent 98447e0 commit 6392336
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
11 changes: 9 additions & 2 deletions x/oracle/simulation/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ import (

"github.com/cometbft/cometbft/crypto/ed25519"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/kv"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

"github.com/Team-Kujira/core/x/oracle/keeper"
sim "github.com/Team-Kujira/core/x/oracle/simulation"
"github.com/Team-Kujira/core/x/oracle/types"
)
Expand All @@ -27,7 +30,11 @@ var (
)

func TestDecodeDistributionStore(t *testing.T) {
cdc := keeper.MakeTestCodec(t)
interfaceRegistry := codectypes.NewInterfaceRegistry()
std.RegisterInterfaces(interfaceRegistry)
authtypes.RegisterInterfaces(interfaceRegistry)

cdc := codec.NewProtoCodec(interfaceRegistry)
dec := sim.NewDecodeStore(cdc)

exchangeRate := math.LegacyNewDecWithPrec(1234, 1)
Expand Down
18 changes: 9 additions & 9 deletions x/scheduler/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func TestCreateHook(t *testing.T) {
ms := NewMsgServerImpl(keeper)

authority := "kujira10d07y265gmmuvt4z0w9aw880jnsr700jt23ame"
executor := "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
contract := "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
executor := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
contract := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`)
frequency := int64(1000)
funds := sdk.NewCoins(sdk.NewInt64Coin("atom", 100))
Expand All @@ -30,7 +30,7 @@ func TestCreateHook(t *testing.T) {
})
require.NoError(t, err)

authority = "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
authority = "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"

_, err = ms.CreateHook(ctx, &types.MsgCreateHook{
Authority: authority,
Expand All @@ -48,8 +48,8 @@ func TestUpdateHook(t *testing.T) {
ms := NewMsgServerImpl(keeper)

authority := "kujira10d07y265gmmuvt4z0w9aw880jnsr700jt23ame"
executor := "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
contract := "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
executor := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
contract := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`)
frequency := int64(1000)
funds := sdk.NewCoins(sdk.NewInt64Coin("atom", 100))
Expand All @@ -74,7 +74,7 @@ func TestUpdateHook(t *testing.T) {
})
require.NoError(t, err)

authority = "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
authority = "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"

_, err = ms.UpdateHook(ctx, &types.MsgUpdateHook{
Authority: authority,
Expand All @@ -93,8 +93,8 @@ func TestDeleteHook(t *testing.T) {
ms := NewMsgServerImpl(keeper)

authority := "kujira10d07y265gmmuvt4z0w9aw880jnsr700jt23ame"
executor := "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
contract := "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
executor := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
contract := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`)
frequency := int64(1000)
funds := sdk.NewCoins(sdk.NewInt64Coin("atom", 100))
Expand All @@ -114,7 +114,7 @@ func TestDeleteHook(t *testing.T) {
})
require.NoError(t, err)

authority = "kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a"
authority = "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh"
_, err = ms.DeleteHook(ctx, &types.MsgDeleteHook{
Authority: authority,
Id: id,
Expand Down
14 changes: 7 additions & 7 deletions x/scheduler/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ func TestMsgCreateHook_ValidateBasic(t *testing.T) {
jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`)

msg := NewMsgCreateHook(
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
jsonMsg,
1000,
sdk.NewCoins(sdk.NewInt64Coin("atom", 100)),
Expand All @@ -38,10 +38,10 @@ func TestMsgUpdateHook_ValidateBasic(t *testing.T) {
jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`)

msg := NewMsgUpdateHook(
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
1,
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
jsonMsg,
1000,
sdk.NewCoins(sdk.NewInt64Coin("atom", 100)),
Expand All @@ -64,7 +64,7 @@ func TestMsgUpdateHook_ValidateBasic_Error(t *testing.T) {

func TestMsgDeleteHook_ValidateBasic(t *testing.T) {
msg := NewMsgDeleteHook(
"kujira1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3ynth5a",
"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh",
1,
)
require.NoError(t, msg.ValidateBasic())
Expand Down

0 comments on commit 6392336

Please sign in to comment.