github.com/Finschia/finschia-sdk@v0.48.1/store/cachemulti/store_test.go (about)

     1  package cachemulti
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/require"
     8  
     9  	"github.com/Finschia/finschia-sdk/store/types"
    10  )
    11  
    12  func TestStoreGetKVStore(t *testing.T) {
    13  	require := require.New(t)
    14  
    15  	s := Store{stores: map[types.StoreKey]types.CacheWrap{}}
    16  	key := types.NewKVStoreKey("abc")
    17  	errMsg := fmt.Sprintf("kv store with key %v has not been registered in stores", key)
    18  
    19  	require.PanicsWithValue(errMsg,
    20  		func() { s.GetStore(key) })
    21  
    22  	require.PanicsWithValue(errMsg,
    23  		func() { s.GetKVStore(key) })
    24  }