Feat v0.9.1 server side subpath routing (#74)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m55s
CI/CD / test-sqlite (push) Successful in 2m58s
CI/CD / build-and-deploy (push) Successful in 1m12s
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / e2e-smoke (push) Has been skipped
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m55s
CI/CD / test-sqlite (push) Successful in 2m58s
CI/CD / build-and-deploy (push) Successful in 1m12s
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #74.
This commit is contained in:
@@ -168,6 +168,57 @@ func TestFindNavSurface_NoMatch(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── aggregateAccess tests ──────────────────────────────────
|
||||
|
||||
func TestAggregateAccess_AllPublic(t *testing.T) {
|
||||
surfaces := []any{
|
||||
map[string]any{"path": "/", "access": "public"},
|
||||
map[string]any{"path": "/submit", "access": "public"},
|
||||
}
|
||||
if got := aggregateAccess(surfaces); got != "public" {
|
||||
t.Errorf("expected public, got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAggregateAccess_AllAuthenticated(t *testing.T) {
|
||||
surfaces := []any{
|
||||
map[string]any{"path": "/", "access": "authenticated"},
|
||||
map[string]any{"path": "/admin", "access": "admin"},
|
||||
}
|
||||
if got := aggregateAccess(surfaces); got != "authenticated" {
|
||||
t.Errorf("expected authenticated, got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAggregateAccess_Mixed(t *testing.T) {
|
||||
surfaces := []any{
|
||||
map[string]any{"path": "/submit", "access": "public"},
|
||||
map[string]any{"path": "/dashboard", "access": "authenticated"},
|
||||
}
|
||||
if got := aggregateAccess(surfaces); got != "mixed" {
|
||||
t.Errorf("expected mixed, got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAggregateAccess_DefaultAccess(t *testing.T) {
|
||||
// No access field → defaults to "authenticated"
|
||||
surfaces := []any{
|
||||
map[string]any{"path": "/"},
|
||||
}
|
||||
if got := aggregateAccess(surfaces); got != "authenticated" {
|
||||
t.Errorf("expected authenticated (default), got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAggregateAccess_SinglePublic(t *testing.T) {
|
||||
surfaces := []any{
|
||||
map[string]any{"path": "/", "access": "public"},
|
||||
}
|
||||
if got := aggregateAccess(surfaces); got != "public" {
|
||||
t.Errorf("expected public, got %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
// ── evaluateAccess tests ────────────────────────────────────
|
||||
// Note: evaluateAccess depends on gin.Context which is hard to unit test
|
||||
// without a full Gin setup. These are covered via handler integration tests.
|
||||
|
||||
Reference in New Issue
Block a user