package handlers_test import ( "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "sneak.berlin/go/upaas/internal/service/app" ) // TestAppPageEnvVarHint checks that the environment variable editor says // changes take effect at the next deploy or rollback, in the warning style. func TestAppPageEnvVarHint(t *testing.T) { t.Parallel() testCtx := setupTestHandlers(t) createdApp, err := testCtx.appSvc.CreateApp(t.Context(), app.CreateAppInput{ Name: "env-hint-app", RepoURL: "git@example.com:user/env-hint-app.git", }) require.NoError(t, err) request := httptest.NewRequestWithContext( t.Context(), http.MethodGet, "/apps/"+createdApp.ID, nil, ) request = addChiURLParams(request, map[string]string{"id": createdApp.ID}) recorder := httptest.NewRecorder() testCtx.handlers.HandleAppDetail().ServeHTTP(recorder, request) require.Equal(t, http.StatusOK, recorder.Code) assert.Contains(t, recorder.Body.String(), `
Environment variable changes take effect at the next deploy or rollback.
`) }