@@ -197,7 +197,7 @@ func TestMigrationNeededError_Error(t *testing.T) {
197197 a .Equal ("migration to 2 needed" , err .Error ())
198198}
199199
200- // Mock dispatcher that implements the required interface
200+ // Mock dispatcher that implements the required interface.
201201type mockDispatcher struct {
202202 handler tg.LoginTokenHandler
203203}
@@ -212,32 +212,32 @@ func TestOnLoginToken(t *testing.T) {
212212 dispatcher := & mockDispatcher {}
213213 loggedIn := OnLoginToken (dispatcher )
214214
215- // Verify that handler was set
215+ // Verify that handler was set.
216216 a .NotNil (dispatcher .handler )
217217
218218 // Test the handler
219219 ctx := context .Background ()
220220 entities := tg.Entities {}
221221 update := & tg.UpdateLoginToken {}
222222
223- // First call should send to channel
223+ // First call should send to channel.
224224 done := make (chan error , 1 )
225225 go func () {
226226 done <- dispatcher .handler (ctx , entities , update )
227227 }()
228228
229- // Should receive signal
229+ // Should receive signal.
230230 select {
231231 case <- loggedIn :
232232 // Good
233- case <- time .After (time .Second ):
233+ case <- time .After (time .Second * 5 ):
234234 t .Fatal ("should receive signal" )
235235 }
236236
237- // Handler should return nil
237+ // Handler should return nil.
238238 a .NoError (<- done )
239239
240- // Second call when channel is full should not block
240+ // Second call when channel is full should not block.
241241 err := dispatcher .handler (ctx , entities , update )
242242 a .NoError (err )
243243}
@@ -246,12 +246,12 @@ func TestToken_Image(t *testing.T) {
246246 a := require .New (t )
247247 token := NewToken ([]byte ("test_token" ), int (time .Now ().Unix ()))
248248
249- // Test with valid QR level
249+ // Test with valid QR level.
250250 img , err := token .Image (qr .L )
251251 a .NoError (err )
252252 a .NotNil (img )
253253
254- // Test with different QR levels
254+ // Test with different QR levels.
255255 levels := []qr.Level {qr .L , qr .M , qr .Q , qr .H }
256256
257257 for _ , level := range levels {
@@ -265,7 +265,7 @@ func TestQR_Import_WithMigration(t *testing.T) {
265265 ctx := context .Background ()
266266 a := require .New (t )
267267
268- // Test with migration function
268+ // Test with migration function.
269269 migrateCalled := false
270270 migrate := func (ctx context.Context , dcID int ) error {
271271 migrateCalled = true
@@ -279,7 +279,7 @@ func TestQR_Import_WithMigration(t *testing.T) {
279279 User : & tg.User {ID : 10 },
280280 }
281281
282- // First call returns migration needed
282+ // First call returns migration needed.
283283 mock .ExpectCall (& tg.AuthExportLoginTokenRequest {
284284 APIID : constant .TestAppID ,
285285 APIHash : constant .TestAppHash ,
@@ -302,7 +302,7 @@ func TestQR_Import_MigrationError(t *testing.T) {
302302 ctx := context .Background ()
303303 a := require .New (t )
304304
305- // Test with migration function that returns error
305+ // Test with migration function that returns error,
306306 migrate := func (ctx context.Context , dcID int ) error {
307307 return testutil .TestError ()
308308 }
0 commit comments