summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-03-29 16:27:17 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-03-29 16:27:17 +0300
commitc6d2d6e65b33dfa880156c9020f70f0512861b24 (patch)
treeead4b4472d8170f1e1128714d768534fbf7e6edb
parentaf412b94f4af388416580cb755b180092658664a (diff)
fix: update test to use running server instead of httptest
-rw-r--r--internal/handlers/handlers_test.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go
index 34b9927..429491f 100644
--- a/internal/handlers/handlers_test.go
+++ b/internal/handlers/handlers_test.go
@@ -15,14 +15,8 @@ import (
func TestQuestionFlow(t *testing.T) {
assert := assert.New(t)
- // Setup test server
- h := NewHandlers(
- config.Config{},
- slog.New(slog.NewJSONHandler(os.Stdout, nil)),
- &MockRepo{},
- )
- ts := httptest.NewServer(http.HandlerFunc(h.MainPage))
- defer ts.Close()
+ // Use running server
+ serverURL := "http://localhost:9000"
// Setup Playwright
pw, err := playwright.Run()
@@ -39,7 +33,7 @@ func TestQuestionFlow(t *testing.T) {
assert.NoError(err)
// Test 1: Load page and verify question
- _, err = page.Goto(ts.URL)
+ _, err = page.Goto(serverURL)
assert.NoError(err)
questionText, err := page.Locator(".question-text").TextContent()