use a common mockReplaceSeparator func
This commit is contained in:
parent
ecfdab47a8
commit
055c2db790
@ -33,6 +33,11 @@ var (
|
||||
flagsPath = path.Join(baseDir, "services", "registration", "pp.csv")
|
||||
)
|
||||
|
||||
// mockReplaceSeparator function
|
||||
var mockReplaceSeparator = func(input string) string {
|
||||
return strings.ReplaceAll(input, ":", ": ")
|
||||
}
|
||||
|
||||
// InitializeTestStore sets up and returns an in-memory database and store.
|
||||
func InitializeTestStore(t *testing.T) (context.Context, *common.UserDataStore) {
|
||||
ctx := context.Background()
|
||||
@ -74,11 +79,6 @@ func TestNewHandlers(t *testing.T) {
|
||||
|
||||
accountService := testservice.TestAccountService{}
|
||||
|
||||
// Mock function for replaceSeparator
|
||||
mockReplaceSeparator := func(input string) string {
|
||||
return strings.ReplaceAll(input, ":", ": ")
|
||||
}
|
||||
|
||||
// Test case for valid UserDataStore
|
||||
t.Run("Valid UserDataStore", func(t *testing.T) {
|
||||
handlers, err := NewHandlers(fm.parser, store, nil, &accountService, mockReplaceSeparator)
|
||||
@ -2007,15 +2007,10 @@ func TestGetVoucherList(t *testing.T) {
|
||||
|
||||
spdb := InitializeTestSubPrefixDb(t, ctx)
|
||||
|
||||
// Mock replaceSeparator function
|
||||
replaceSeparator := func(input string) string {
|
||||
return strings.ReplaceAll(input, ":", ": ")
|
||||
}
|
||||
|
||||
// Initialize Handlers
|
||||
h := &Handlers{
|
||||
prefixDb: spdb,
|
||||
ReplaceSeparator: replaceSeparator,
|
||||
ReplaceSeparator: mockReplaceSeparator,
|
||||
}
|
||||
|
||||
mockSyms := []byte("1:SRF\n2:MILO")
|
||||
|
Loading…
Reference in New Issue
Block a user