github.com/KiraCore/sekai@v0.3.43/x/gov/keeper/data_registry_test.go (about) 1 package keeper_test 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 8 simapp "github.com/KiraCore/sekai/app" 9 "github.com/KiraCore/sekai/x/gov/types" 10 tmproto "github.com/cometbft/cometbft/proto/tendermint/types" 11 ) 12 13 func TestKeeper_UpsertDataRegistryEntry(t *testing.T) { 14 app := simapp.Setup(false) 15 ctx := app.NewContext(false, tmproto.Header{}) 16 17 entry := types.NewDataRegistryEntry( 18 "someHAsh", 19 "someURL", 20 "someEncoding", 21 1234, 22 ) 23 24 app.CustomGovKeeper.UpsertDataRegistryEntry(ctx, "CodeOfConduct", entry) 25 26 savedDataRegistry, found := app.CustomGovKeeper.GetDataRegistryEntry(ctx, "CodeOfConduct") 27 require.True(t, found) 28 29 require.Equal(t, entry, savedDataRegistry) 30 31 _, found = app.CustomGovKeeper.GetDataRegistryEntry(ctx, "NonExistingKey") 32 require.False(t, found) 33 }