diff --git a/repository/account/memory.go b/repository/account/memory.go index 975ed2b..7cce061 100644 --- a/repository/account/memory.go +++ b/repository/account/memory.go @@ -13,8 +13,8 @@ type AccountRepositoryMemory struct { var _ AccountRepository = new(AccountRepositoryMemory) -func NewAccountRepositoryMemory() *AccountRepositoryMemory { - return &AccountRepositoryMemory{ accounts: make([]*model.Account, 0) } +func NewAccountRepositoryMemory(accounts []*model.Account) *AccountRepositoryMemory { + return &AccountRepositoryMemory{ accounts: accounts } } func (repo *AccountRepositoryMemory) GetAll() ([]*model.Account, error) { diff --git a/service/account/account_test.go b/service/account/account_test.go index f12fdaf..0c9a372 100644 --- a/service/account/account_test.go +++ b/service/account/account_test.go @@ -18,7 +18,7 @@ func init() { if err != nil { panic(err) } defer devNullFile.Close() - repo := repository.NewAccountRepositoryMemory() + repo := repository.NewAccountRepositoryMemory(make([]*model.Account, 0)) service = NewAccountService( repo, log.New(devNullFile, "", model.DEFAULT_LOG_FLAGS),