oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package thintest
2
3import (
4 "net/url"
5 "regexp"
6 "strings"
7 "testing"
8)
9
10// TestPagesEmptyConversationStarters: the empty conversation is a drawing
11// hidden from screen readers, a heading and a named group of three real
12// buttons (Paul, 2026-11-20: "something that just entices you to type a
13// first message"). Without script a starter is a GET that opens the
14// conversation with its words in the composer; any other value drafts
15// nothing.
16func TestPagesEmptyConversationStarters(t *testing.T) {
17 // A rig with no message sent: the conversation is empty.
18 r := &toolRig{rig: newRig(t)}
19 owner := r.inst.Cookie()
20 page := r.get(owner, "/conversation", 200)
21 welcome := regexp.MustCompile(`(?s)<li equipo-welcome data-empty-state="conversation.empty">.*?</li>`).FindString(page)
22 for _, want := range []string{
23 `<svg equipo-welcome-art viewBox="0 0 112 70" aria-hidden="true" focusable="false">`,
24 `<h2 equipo-welcome-title>What needs doing?</h2>`,
25 `<form equipo-starters method="get" action="/conversation" aria-label="Ways to start">`,
26 `<button type="submit" rst-btn name="start" value="bug" data-draft="Fix a bug where ">`,
27 `<span>Fix a bug</span></button>`,
28 `<button type="submit" rst-btn name="start" value="feature" data-draft="Plan a feature that ">`,
29 `<span>Plan a feature</span></button>`,
30 `<button type="submit" rst-btn name="start" value="project" data-draft="What’s the latest on ">`,
31 `<span>Ask about a project</span></button>`,
32 } {
33 if !strings.Contains(welcome, want) {
34 t.Fatalf("empty conversation lacks %q:\n%s", want, welcome)
35 }
36 }
37 if strings.Contains(page, "Your coordinator picks the project") {
38 t.Fatal("the old empty line is still there")
39 }
40 for k, draft := range map[string]string{"bug": "Fix a bug where ", "feature": "Plan a feature that ", "project": "What’s the latest on "} {
41 if c := r.get(owner, "/conversation?start="+k, 200); !strings.Contains(c, `autofocus>`+draft+`</textarea>`) {
42 t.Fatalf("start=%s composer:\n%s", k, regexp.MustCompile(`(?s)<textarea id="chat-body".*?</textarea>`).FindString(c))
43 }
44 }
45 for _, k := range []string{"", "label", "bug_draft", "<script>", "../empty"} {
46 if c := r.get(owner, "/conversation?start="+url.QueryEscape(k), 200); strings.Contains(c, `autofocus>`) {
47 t.Fatalf("start=%q drafted something", k)
48 }
49 }
50}
51