summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/controller_test.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-16 13:43:38 -0600
committermo khan <mo@mokhan.ca>2025-04-16 13:43:38 -0600
commitd24708251deb598c522a67e6615d3403d65dbcdc (patch)
tree6f8989aaedd0ba5a9cf2450a7f6097ec2e2b1fb2 /app/controllers/dashboard/controller_test.go
parentb7ff80b7be532f4bb64c1daf8cef3462f9938362 (diff)
feat: render an html page when a user is logged in
Diffstat (limited to 'app/controllers/dashboard/controller_test.go')
-rw-r--r--app/controllers/dashboard/controller_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/dashboard/controller_test.go b/app/controllers/dashboard/controller_test.go
index 0bfb3d6..ac9e10d 100644
--- a/app/controllers/dashboard/controller_test.go
+++ b/app/controllers/dashboard/controller_test.go
@@ -4,6 +4,7 @@ import (
"net/http"
"testing"
+ "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/domain"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/test"
"gotest.tools/v3/assert"
)
@@ -25,5 +26,16 @@ func TestController(t *testing.T) {
assert.Equal(t, "/", location)
})
})
+
+ t.Run("when authenticated", func(t *testing.T) {
+ t.Run("renders a dashboard page", func(t *testing.T) {
+ ctx := CurrentUserKey.With(t.Context(), &domain.User{})
+ r, w := test.RequestResponse("GET", "/dashboard", test.WithContext(ctx))
+
+ mux.ServeHTTP(w, r)
+ assert.Equal(t, http.StatusOK, w.Code)
+ assert.Equal(t, "text/html", w.Header().Get("Content-Type"))
+ })
+ })
})
}