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", "