summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihna123 <mihailonvojinovic@gmail.com>2026-08-29 23:42:09 +0200
committermihna123 <mihailonvojinovic@gmail.com>2026-08-29 23:42:09 +0200
commit50b524658c9dc66af10790a1b496910273802303 (patch)
tree025df85c843547c75ee828acc33ed42869cfd108
parent3380048b011c8f9289f16c4e39b72013424923cf (diff)
downloadopenstore-50b524658c9dc66af10790a1b496910273802303.tar.gz
openstore-50b524658c9dc66af10790a1b496910273802303.zip
user: rename internal test functions
-rw-r--r--internal/user/mock_test.go2
-rw-r--r--internal/user/service_test.go12
2 files changed, 7 insertions, 7 deletions
diff --git a/internal/user/mock_test.go b/internal/user/mock_test.go
index 0f0f672..caea4da 100644
--- a/internal/user/mock_test.go
+++ b/internal/user/mock_test.go
@@ -5,7 +5,7 @@ type RepositoryMock struct {
err error
}
-func getEmptyRepository() *RepositoryMock {
+func newEmptyRepository() *RepositoryMock {
return &RepositoryMock{users: []User{}, err: nil}
}
diff --git a/internal/user/service_test.go b/internal/user/service_test.go
index 16353d2..8c724ff 100644
--- a/internal/user/service_test.go
+++ b/internal/user/service_test.go
@@ -14,9 +14,9 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
-func NewTestUserService(t *testing.T) *Service {
+func newTestUserService(t *testing.T) *Service {
t.Helper()
- return &Service{repository: getEmptyRepository(), bcryptCost: bcrypt.MinCost}
+ return &Service{repository: newEmptyRepository(), bcryptCost: bcrypt.MinCost}
}
func TestRegisterInputValidateFaultyData(t *testing.T) {
@@ -37,7 +37,7 @@ func TestRegisterInputValidateFaultyData(t *testing.T) {
func TestRegisterBadInput(t *testing.T) {
in := &RegisterInput{}
- s := NewTestUserService(t)
+ s := newTestUserService(t)
_, err := s.Register(in)
if err == nil {
t.Error("no error when registering with faulty input")
@@ -45,7 +45,7 @@ func TestRegisterBadInput(t *testing.T) {
}
func TestRegisterExistingUser(t *testing.T) {
- r := getEmptyRepository()
+ r := newEmptyRepository()
r.fill()
badInputs := map[string]RegisterInput{
@@ -97,7 +97,7 @@ func TestRegisterRepositoryError(t *testing.T) {
}
func TestSuccessfulRegister(t *testing.T) {
- s := NewTestUserService(t)
+ s := newTestUserService(t)
in := &RegisterInput{
Username: "happyuser123",
Email: "happyuser@email.com",
@@ -116,7 +116,7 @@ func TestSuccessfulRegister(t *testing.T) {
}
func TestRegisterSameUserTwice(t *testing.T) {
- s := NewTestUserService(t)
+ s := newTestUserService(t)
in := &RegisterInput{
Username: "happyuser123",
Email: "happyuser@email.com",