package memoriatest import ( "html" "net/http" "net/url" "regexp" "strings" "testing" "amadan.net/oficina/estilo.git/sky" ) // The sign-in page is the suite's door (estilo chrome, 2026-09-29): one // card on the team's sky with Memoria's mark and name at its head. Paul's // ruling is that every app's sign-in is "a version of the Oficina sign-in // screen", so this pins that the page IS the door rather than memoria's // old bare form — and that everything the door links is actually served: // a card whose stylesheet 404s, or a sky whose layers nothing mounts, // renders as a plain form with no error anywhere. // // And the door's form must still sign someone in. Its field is named by // estilo, not by this app, so the POST below uses the name the RENDERED // page carries, not one typed here: if the door ever renamed the field, // an owner's address would stop reaching the handler and this fails. // // MUTATION-TESTED 2026-09-29 by its author (so they prove consistency, not // coverage — AGENTS.md), each reverted: the sky mount removed from app.go // -> both served layers 404 here (and TestSkyRouteIsEstilosPrefix red); // the chrome.css link removed from signin.html -> "does not link chrome.css". func TestSigninPageIsTheDoor(t *testing.T) { h, rec := signinApp(t) rr := get(t, h, "/signin") if rr.Code != http.StatusOK { t.Fatalf("GET /signin = %d", rr.Code) } body := rr.Body.String() for _, want := range []string{ "estilo-door", `Memoria`, `

Sign in

`, // The suite's copy (shared chrome §9.2): the help under the field, // and Open source reachable while signed out (§8.4). "We’ll email you a link that signs you in. It works once and expires in 15 minutes.", `href="/help/open-source"`, `action="/auth/begin"`, // Paul, 2026-10-01: the door's button says "Sign in". `>Sign in`, // The door's tab title (estilo chrome.Title). `Sign in · Memoria`, } { if !strings.Contains(html.UnescapeString(body), html.UnescapeString(want)) { t.Errorf("the sign-in page lacks %q", want) } } // Retired (§9.2): "Email me a link" (Paul, 2026-10-01), the lede // "Memoria holds your team's work…", and the // footer's egress claim, which is about searching and is said only to // somebody signed in. // And the old title, "Sign in — Memoria". for _, gone := range []string{"Email me a link", "holds your team", "]* src="([^"]+)"`).FindAllStringSubmatch(body, -1) if len(layers) < 3 { t.Fatalf("found %d sky layers on the sign-in page, want the placeholders and the served layers", len(layers)) } served := 0 for _, m := range layers { src := html.UnescapeString(m[2]) if strings.HasPrefix(src, "data:") { continue } served++ if !strings.HasPrefix(src, sky.Prefix) { t.Errorf("sky layer %s is %q, not under %s", m[1], src, sky.Prefix) } if got := get(t, h, src); got.Code != http.StatusOK || got.Header().Get("Content-Type") != "image/svg+xml" { t.Errorf("GET %s = %d %q; the sky layer is linked but not served", src, got.Code, got.Header().Get("Content-Type")) } } if served == 0 { t.Error("no sky layer is served from the app; the served half of the sky was never checked") } // The door's stylesheets are linked and served. for _, name := range []string{"chrome", "sky"} { m := regexp.MustCompile(`href="(/static/` + name + `[^"]*\.css)"`).FindStringSubmatch(body) if m == nil { t.Errorf("the sign-in page does not link %s.css", name) continue } if got := get(t, h, m[1]); got.Code != http.StatusOK || !strings.Contains(got.Body.String(), "estilo-") { t.Errorf("GET %s = %d; the door's stylesheet is linked but not served", m[1], got.Code) } } // The field name the door renders, read off the page. field := regexp.MustCompile(`