github.com/masterhung0112/hk_server/v5@v5.0.0-20220302090640-ec71aef15e1c/services/users/service_test.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package users
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/masterhung0112/hk_server/v5/model"
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestNew(t *testing.T) {
    14  	_, err := New(ServiceConfig{})
    15  	require.Error(t, err)
    16  
    17  	dbStore := mainHelper.GetStore()
    18  
    19  	cfn := func() *model.Config {
    20  		return &model.Config{}
    21  	}
    22  
    23  	_, err = New(ServiceConfig{
    24  		UserStore:    dbStore.User(),
    25  		SessionStore: dbStore.Session(),
    26  		OAuthStore:   dbStore.OAuth(),
    27  		ConfigFn:     cfn,
    28  	})
    29  	require.NoError(t, err)
    30  }