test(server): mock title fetcher in router tests to remove network dependency
This commit is contained in:
@@ -77,7 +77,8 @@ func setupTestHandlers() (*handlers.AuthHandler, *handlers.PostHandler, *handler
|
|||||||
emailSender := &testutils.MockEmailSender{}
|
emailSender := &testutils.MockEmailSender{}
|
||||||
|
|
||||||
voteService := services.NewVoteService(voteRepo, postRepo, nil)
|
voteService := services.NewVoteService(voteRepo, postRepo, nil)
|
||||||
metadataService := services.NewURLMetadataService()
|
titleFetcher := &testutils.MockTitleFetcher{}
|
||||||
|
titleFetcher.SetTitle("Example Domain")
|
||||||
|
|
||||||
mockRefreshRepo := &mockRefreshTokenRepository{}
|
mockRefreshRepo := &mockRefreshTokenRepository{}
|
||||||
mockDeletionRepo := &mockAccountDeletionRepository{}
|
mockDeletionRepo := &mockAccountDeletionRepository{}
|
||||||
@@ -94,7 +95,7 @@ func setupTestHandlers() (*handlers.AuthHandler, *handlers.PostHandler, *handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
authHandler := handlers.NewAuthHandler(authFacade, userRepo)
|
authHandler := handlers.NewAuthHandler(authFacade, userRepo)
|
||||||
postHandler := handlers.NewPostHandler(postRepo, metadataService, voteService)
|
postHandler := handlers.NewPostHandler(postRepo, titleFetcher, voteService)
|
||||||
voteHandler := handlers.NewVoteHandler(voteService)
|
voteHandler := handlers.NewVoteHandler(voteService)
|
||||||
userHandler := handlers.NewUserHandler(userRepo, authFacade)
|
userHandler := handlers.NewUserHandler(userRepo, authFacade)
|
||||||
apiHandler := handlers.NewAPIHandler(testutils.AppTestConfig, postRepo, userRepo, voteService)
|
apiHandler := handlers.NewAPIHandler(testutils.AppTestConfig, postRepo, userRepo, voteService)
|
||||||
|
|||||||
Reference in New Issue
Block a user