Skip to content

Commit

Permalink
MF-249 - Change names
Browse files Browse the repository at this point in the history
Signed-off-by: zzokki81 <zoran.rebic@outlook.com>
  • Loading branch information
zzokki81 committed Aug 4, 2023
1 parent 397a727 commit 5d6a36c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions users/mocks/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@ type userRepositoryMock struct {
}

// NewUserRepository creates in-memory user repository
func NewUserRepository(usr []user.User) users.UserRepository {
users := make(map[string]users.User)
mockUsersByID := make(map[string]user.User)
func NewUserRepository(users []user.User) users.UserRepository {
usersByEmail := make(map[string]user.User)
usersByID := make(map[string]user.User)

for _, u := range usr {
mockUsersByID[u.ID] = u
}

for _, u := range usr {
users[u.Email] = u
for _, u := range users {
usersByEmail[u.Email] = u
usersByID[u.ID] = u
}

return &userRepositoryMock{
usersByEmail: users,
usersByID: mockUsersByID,
usersByEmail: usersByEmail,
usersByID: usersByID,
}
}

Expand Down

0 comments on commit 5d6a36c

Please sign in to comment.