From be78280c669a04c112afaf1801f22ed2eec7c55a Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sun, 16 Aug 2026 13:19:22 +0200 Subject: refactor(web): establish JavaScript module tooling --- web/server_test.go | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'web/server_test.go') diff --git a/web/server_test.go b/web/server_test.go index a4ee0b7..654d6d5 100644 --- a/web/server_test.go +++ b/web/server_test.go @@ -134,10 +134,10 @@ func TestHandlerRendersRideDetailWithEmbeddedRoute(t *testing.T) { assert.Contains(t, body, `class="ride-detail-columns`) assert.NotContains(t, body, "Climbs to match") assert.Contains(t, body, `class="ride-detail-main"`) - assert.Contains(t, body, ``) - assert.Contains(t, body, ``) - assert.Contains(t, body, ``) - assert.Contains(t, body, ``) + assert.Contains(t, body, ``) + assert.Contains(t, body, ``) + assert.NotContains(t, body, ``) + assert.NotContains(t, body, `const consumeEvents = async`) + + syncRequest := httptest.NewRequest(http.MethodGet, "/static/sync.js", nil) + syncResponse := httptest.NewRecorder() + server.Handler().ServeHTTP(syncResponse, syncRequest) + + assert.Equal(t, http.StatusOK, syncResponse.Code) + assert.Equal(t, "text/javascript; charset=utf-8", syncResponse.Header().Get("Content-Type")) + assert.Contains(t, syncResponse.Body.String(), `text/event-stream`) } func TestSyncRedirectsToOAuthWhenUnauthenticated(t *testing.T) { -- cgit v1.2.3