package movementtest import ( "html/template" "net/http" "strings" "testing" movement "amadan.net/carlos/movement/internal/movement" ) // The all-in page hands its reader the model's output and then says so. The // disclosure is the joke, so it has to be visible, on that page, and nowhere // else — and since 2026-09-03 it sits AFTER the text it describes, because a // note about copy that arrives before the copy is just a preamble. func TestTheDisclosureFollowsTheAllInReplyAndAppearsNowhereElse(t *testing.T) { h := newApp(t) line := movement.T("stance.enthusiast.disclosure") rec := get(t, h, "/all-in") if rec.Code != http.StatusOK { t.Fatalf("GET /all-in: %d", rec.Code) } body := rec.Body.String() at := strings.Index(body, line) if at < 0 { t.Fatal("the disclosure is missing from the all-in page") } // After the reply, not before it: the last paragraph of the message has // to appear earlier in the document than the note about it. // // Compared escaped, because that is what reaches the page — the copy has // apostrophes and html/template renders them as ', so a raw // comparison fails on correct output. msg := movement.Paragraphs("stance.enthusiast.message") var esc strings.Builder template.HTMLEscape(&esc, []byte(msg[len(msg)-1])) if end := strings.Index(body, esc.String()); end < 0 { t.Fatal("the all-in reply is missing its last paragraph") } else if end > at { t.Error("the disclosure appears before the text it describes") } for _, other := range []string{"/no-ai", "/uneasy"} { if strings.Contains(get(t, h, other).Body.String(), line) { t.Errorf("%s carries the all-in page's disclosure", other) } } } // Both fields say what goes in them. A ruled underline with nothing in it // reads as a rule, not as somewhere to type. func TestFieldsCarryPlaceholders(t *testing.T) { h := newApp(t) body := get(t, h, "/uneasy").Body.String() for _, id := range []string{"form.email.placeholder", "form.background.placeholder"} { if !strings.Contains(body, movement.T(id)) { t.Errorf("%s never reaches the form", id) } } if strings.Count(body, "placeholder=") < 2 { t.Error("both the address and the background field need a placeholder") } }