@@ -49,10 +49,10 @@ func TestService_Register_Success(t *testing.T) {
4949 svc , repo , pub := newTestService (t )
5050 ctx := context .Background ()
5151
52- repo .On ("GetUserByEmail" , ctx , "alice@example.com" ).Return (nil , identity .ErrNotFound )
53- repo .On ("CreateUser" , ctx , mock .AnythingOfType ("*aggregate.PlatformUser" )).Return (nil )
54- repo .On ("CreateEmailVerification" , ctx , mock .AnythingOfType ("*aggregate.EmailVerification" )).Return (nil )
55- pub .On ("Publish" , ctx , mock .AnythingOfType ("domainevent.Event" )).Return (nil )
52+ repo .On ("GetUserByEmail" , mock . Anything , "alice@example.com" ).Return (nil , identity .ErrNotFound )
53+ repo .On ("CreateUser" , mock . Anything , mock .AnythingOfType ("*aggregate.PlatformUser" )).Return (nil )
54+ repo .On ("CreateEmailVerification" , mock . Anything , mock .AnythingOfType ("*aggregate.EmailVerification" )).Return (nil )
55+ pub .On ("Publish" , mock . Anything , mock .AnythingOfType ("domainevent.Event" )).Return (nil )
5656
5757 result , err := svc .Register (ctx , identity.RegisterInput {
5858 Email : "alice@example.com" ,
@@ -72,7 +72,7 @@ func TestService_Register_DuplicateEmail(t *testing.T) {
7272 ctx := context .Background ()
7373
7474 existing := & identity.PlatformUser {ID : "existing-id" , Email : "alice@example.com" }
75- repo .On ("GetUserByEmail" , ctx , "alice@example.com" ).Return (existing , nil )
75+ repo .On ("GetUserByEmail" , mock . Anything , "alice@example.com" ).Return (existing , nil )
7676
7777 _ , err := svc .Register (ctx , identity.RegisterInput {
7878 Email : "alice@example.com" ,
@@ -96,9 +96,9 @@ func TestService_Login_Success(t *testing.T) {
9696 Role : identity .RoleCustomer ,
9797 }
9898
99- repo .On ("GetUserByEmail" , ctx , "alice@example.com" ).Return (user , nil )
100- repo .On ("CreateSession" , ctx , mock .AnythingOfType ("*aggregate.Session" )).Return (nil )
101- pub .On ("Publish" , ctx , mock .AnythingOfType ("domainevent.Event" )).Return (nil )
99+ repo .On ("GetUserByEmail" , mock . Anything , "alice@example.com" ).Return (user , nil )
100+ repo .On ("CreateSession" , mock . Anything , mock .AnythingOfType ("*aggregate.Session" )).Return (nil )
101+ pub .On ("Publish" , mock . Anything , mock .AnythingOfType ("domainevent.Event" )).Return (nil )
102102
103103 result , err := svc .Login (ctx , identity.LoginInput {
104104 Email : "alice@example.com" ,
@@ -126,7 +126,7 @@ func TestService_Login_WrongPassword(t *testing.T) {
126126 Role : identity .RoleCustomer ,
127127 }
128128
129- repo .On ("GetUserByEmail" , ctx , "alice@example.com" ).Return (user , nil )
129+ repo .On ("GetUserByEmail" , mock . Anything , "alice@example.com" ).Return (user , nil )
130130
131131 _ , err := svc .Login (ctx , identity.LoginInput {
132132 Email : "alice@example.com" ,
@@ -140,7 +140,7 @@ func TestService_Login_UserNotFound(t *testing.T) {
140140 svc , repo , _ := newTestService (t )
141141 ctx := context .Background ()
142142
143- repo .On ("GetUserByEmail" , ctx , "unknown@example.com" ).Return (nil , identity .ErrNotFound )
143+ repo .On ("GetUserByEmail" , mock . Anything , "unknown@example.com" ).Return (nil , identity .ErrNotFound )
144144
145145 _ , err := svc .Login (ctx , identity.LoginInput {
146146 Email : "unknown@example.com" ,
@@ -155,12 +155,12 @@ func TestService_SetupNeeded(t *testing.T) {
155155 svc , repo , _ := newTestService (t )
156156 ctx := context .Background ()
157157
158- repo .On ("CountAdmins" , ctx ).Return (int64 (0 ), nil ).Once ()
158+ repo .On ("CountAdmins" , mock . Anything ).Return (int64 (0 ), nil ).Once ()
159159 need , err := svc .SetupNeeded (ctx )
160160 require .NoError (t , err )
161161 assert .True (t , need )
162162
163- repo .On ("CountAdmins" , ctx ).Return (int64 (1 ), nil ).Once ()
163+ repo .On ("CountAdmins" , mock . Anything ).Return (int64 (1 ), nil ).Once ()
164164 need , err = svc .SetupNeeded (ctx )
165165 require .NoError (t , err )
166166 assert .False (t , need )
@@ -238,11 +238,11 @@ func TestService_VerifyEmail_Success(t *testing.T) {
238238 EmailVerified : false ,
239239 }
240240
241- repo .On ("GetEmailVerification" , ctx , "abc123" ).Return (verification , nil )
242- repo .On ("GetUserByIDForUpdate" , ctx , "user-1" ).Return (user , nil )
243- repo .On ("UpdateUser" , ctx , mock .AnythingOfType ("*aggregate.PlatformUser" )).Return (nil )
244- repo .On ("DeleteEmailVerification" , ctx , "v-1" ).Return (nil )
245- pub .On ("Publish" , ctx , mock .AnythingOfType ("domainevent.Event" )).Return (nil )
241+ repo .On ("GetEmailVerification" , mock . Anything , "abc123" ).Return (verification , nil )
242+ repo .On ("GetUserByIDForUpdate" , mock . Anything , "user-1" ).Return (user , nil )
243+ repo .On ("UpdateUser" , mock . Anything , mock .AnythingOfType ("*aggregate.PlatformUser" )).Return (nil )
244+ repo .On ("DeleteEmailVerification" , mock . Anything , "v-1" ).Return (nil )
245+ pub .On ("Publish" , mock . Anything , mock .AnythingOfType ("domainevent.Event" )).Return (nil )
246246
247247 err := svc .VerifyEmail (ctx , "abc123" )
248248
@@ -263,7 +263,7 @@ func TestService_VerifyEmail_Expired(t *testing.T) {
263263 ExpiresAt : time .Now ().Add (- time .Hour ), // expired
264264 }
265265
266- repo .On ("GetEmailVerification" , ctx , "abc123" ).Return (verification , nil )
266+ repo .On ("GetEmailVerification" , mock . Anything , "abc123" ).Return (verification , nil )
267267
268268 err := svc .VerifyEmail (ctx , "abc123" )
269269
@@ -352,7 +352,7 @@ func TestService_RefreshToken_Expired(t *testing.T) {
352352 ExpiresAt : time .Now ().Add (- time .Hour ), // expired
353353 }
354354
355- repo .On ("GetSessionByRefreshToken" , ctx , "old-refresh-token" ).Return (session , nil )
355+ repo .On ("GetSessionByRefreshToken" , mock . Anything , "old-refresh-token" ).Return (session , nil )
356356
357357 _ , err := svc .RefreshToken (ctx , "old-refresh-token" )
358358
0 commit comments