hunk.code_window: 		assert.Equal(t, reaction, []*model.Reaction{&fakeReaction})
   		cachedStore.Reaction().GetForPost("123", true)
   		mockStore.Reaction().(*mocks.ReactionStore).AssertNumberOfCalls(t, "GetForPost", 1)
   	})
   	t.Run("first call not cached, second force no cached", func(t *testing.T) {
   		mockStore := getMockStore()
   		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
   		cachedStore.Reaction().GetForPost("123", true)
   		mockStore.Reaction().(*mocks.ReactionStore).AssertNumberOfCalls(t, "GetForPost", 1)
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep keep
hunk.after_edit: 	t.Run("first call not cached, second force not cached", func(t *testing.T) {
  
hunk.file_path: store/localcachelayer/reaction_layer_test.go
hunk.type: replace
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  package localcachelayer
  
  import (
  	"testing"
  
  	"github.com/stretchr/testify/assert"
  	"github.com/stretchr/testify/require"
  
  	"github.com/mattermost/mattermost-server/v5/store/storetest"
  	"github.com/mattermost/mattermost-server/v5/store/storetest/mocks"
  )
  
  func TestChannelStore(t *testing.T) {
  	StoreTest(t, storetest.TestReactionStore)
  }
  
  func TestChannelStoreChannelMemberCountsCache(t *testing.T) {
  	countResult := int64(10)
  
  	t.Run("first call not cached, second cached and returning same data", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		count, err := cachedStore.Channel().GetMemberCount("id", true)
  		require.Nil(t, err)
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  		count, err = cachedStore.Channel().GetMemberCount("id", true)
  		require.Nil(t, err)
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  	})
  
  	t.Run("first call not cached, second force no cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  		cachedStore.Channel().GetMemberCount("id", false)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 2)
  	})
  
  	t.Run("first call force no cached, second not cached, third cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetMemberCount("id", false)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 2)
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 2)
  	})
  
  	t.Run("first call with GetMemberCountFromCache not cached, second cached and returning same data", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		count := cachedStore.Channel().GetMemberCountFromCache("id")
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  		count = cachedStore.Channel().GetMemberCountFromCache("id")
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  	})
  
  	t.Run("first call not cached, clear cache, second call not cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  		cachedStore.Channel().ClearCaches()
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 2)
  	})
  
  	t.Run("first call not cached, invalidate cache, second call not cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 1)
  		cachedStore.Channel().InvalidateMemberCount("id")
  		cachedStore.Channel().GetMemberCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetMemberCount", 2)
  	})
  }
  
  func TestChannelStoreChannelPinnedPostsCountsCache(t *testing.T) {
  	countResult := int64(10)
  
  	t.Run("first call not cached, second cached and returning same data", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		count, err := cachedStore.Channel().GetPinnedPostCount("id", true)
  		require.Nil(t, err)
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 1)
  		count, err = cachedStore.Channel().GetPinnedPostCount("id", true)
  		require.Nil(t, err)
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 1)
  	})
  
  	t.Run("first call not cached, second force no cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 1)
  		cachedStore.Channel().GetPinnedPostCount("id", false)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 2)
  	})
  
  	t.Run("first call force no cached, second not cached, third cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetPinnedPostCount("id", false)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 1)
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 2)
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 2)
  	})
  
  	t.Run("first call not cached, clear cache, second call not cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 1)
  		cachedStore.Channel().ClearCaches()
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 2)
  	})
  
  	t.Run("first call not cached, invalidate cache, second call not cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 1)
  		cachedStore.Channel().InvalidatePinnedPostCount("id")
  		cachedStore.Channel().GetPinnedPostCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetPinnedPostCount", 2)
  	})
  }
  
  func TestChannelStoreGuestCountCache(t *testing.T) {
  	countResult := int64(12)
  
  	t.Run("first call not cached, second cached and returning same data", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		count, err := cachedStore.Channel().GetGuestCount("id", true)
  		require.Nil(t, err)
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 1)
  		count, err = cachedStore.Channel().GetGuestCount("id", true)
  		require.Nil(t, err)
  		assert.Equal(t, count, countResult)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 1)
  	})
  
  	t.Run("first call not cached, second force no cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 1)
  		cachedStore.Channel().GetGuestCount("id", false)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 2)
  	})
  
  	t.Run("first call force no cached, second not cached, third cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetGuestCount("id", false)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 1)
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 2)
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 2)
  	})
  
  	t.Run("first call not cached, clear cache, second call not cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 1)
  		cachedStore.Channel().ClearCaches()
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 2)
  	})
  
  	t.Run("first call not cached, invalidate cache, second call not cached", func(t *testing.T) {
  		mockStore := getMockStore()
  		cachedStore := NewLocalCacheLayer(mockStore, nil, nil)
  
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 1)
  		cachedStore.Channel().InvalidateGuestCount("id")
  		cachedStore.Channel().GetGuestCount("id", true)
  		mockStore.Channel().(*mocks.ChannelStore).AssertNumberOfCalls(t, "GetGuestCount", 2)
  	})
  }
  