Skip to content

Commit

Permalink
fix broken tests pt.2
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brennan2005 committed Mar 17, 2024
1 parent a1dcd14 commit eaf019d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 4 additions & 1 deletion backend/src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ func main() {
Exit("Error with connection pooling: %s", err.Error())
}

app := server.Init(db, *config)
openAi := search.NewOpenAIClient(config.OpenAISettings)
pinecone := search.NewPineconeClient(openAi, config.PineconeSettings)

app := server.Init(db, pinecone, *config)

err = app.Listen(fmt.Sprintf("%s:%d", config.Application.Host, config.Application.Port))
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions backend/src/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ import (
// @contact.email [email protected] and [email protected]
// @host 127.0.0.1:8080
// @BasePath /
func Init(db *gorm.DB, settings config.Settings) *fiber.App {
func Init(db *gorm.DB, pinecone search.PineconeClientInterface, settings config.Settings) *fiber.App {
app := newFiberApp(settings.Application)

validate, err := utilities.RegisterCustomValidators()
if err != nil {
panic(fmt.Sprintf("Error registering custom validators: %s", err))
}

openAi := search.NewOpenAIClient(settings.OpenAISettings)
pinecone := search.NewPineconeClient(openAi, settings.PineconeSettings)

authMiddleware := middleware.NewAuthAuthMiddlewareService(db, validate, settings.Auth)

apiv1 := app.Group("/api/v1")
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/api/helpers/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func spawnApp() (*TestApp, error) {
}

return &TestApp{
App: server.Init(connectionWithDB, *configuration),
App: server.Init(connectionWithDB, NewPineconeMockClient(), *configuration),
Address: fmt.Sprintf("http://%s", listener.Addr().String()),
Conn: connectionWithDB,
Settings: *configuration,
Expand Down

0 comments on commit eaf019d

Please sign in to comment.