oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "amadan.net/oficina/equipo/internal/wire"
5 "bytes"
6 "strconv"
7 "strings"
8 "testing"
9 "time"
10)
11
12// The sidebar's specialist rows say what the thin core's steps are
13// doing, compactly (the team panel, 2026-11-11): idle is the one muted
14// word; working is the living mark and a clock, then one line with the
15// task's title and what it is doing in plain words. The attempt shows
16// only above 1; there is no inner card, stage chip or raw line. Each row
17// is a link to its specialist's drawer. Counts are quiet (nothing at
18// zero) and "Unavailable" only when they could not be read. Order:
19// Conversation, Projects, Tasks, Needs you.
20func TestChatNavigationStatus(t *testing.T) {
21 task := wire.Task{ID: "tkabc", Title: "Swipe from the edge to go back doesn't work", Project: "Woodstar"}
22 started := time.Now().Add(-90 * time.Second)
23 first := wire.Step{ID: "st1", Attempt: 1, StartedAt: &started}
24 second := wire.Step{ID: "st2", Attempt: 2, StartedAt: &started}
25 now := humaneActivity(wire.ActivityLine{Kind: wire.ActivityRun, Subject: `/bin/bash -lc "cat ios/Woodstar/NavigationStack.swift"`})
26 for _, tc := range []struct {
27 rail railView
28 want []string
29 not []string
30 }{
31 {railView{Tasks: railCount{0, true}, Projects: railCount{0, true}, Needs: railCount{0, true}, Specialists: []railSpecialist{{Key: "engineering", Icon: "code", CopyKey: "nav.engineering"}}}, []string{`<a equipo-spec id="nav-engineering" href="/team/engineering" data-team-open data-specialist="engineering" data-state="idle">`, "<span equipo-spec-state>idle</span>"}, []string{"data-count", "equipo-spec-now", "equipo-mark", "tabindex"}},
32 {railView{Tasks: railCount{2, true}, Needs: railCount{1, true}, Specialists: []railSpecialist{{Key: "review", Icon: "check-circle", CopyKey: "nav.review", Task: &task, Step: &first, Now: now}}}, []string{`href="/team/review" data-team-open data-specialist="review" data-state="working"`, "equipo-mark", `data-since="` + strconv.FormatInt(started.UnixMilli(), 10) + `"`, `<span equipo-spec-now data-step="st1" title="Swipe from the edge to go back doesn&#39;t work · Reading NavigationStack.swift"><span equipo-nav-task>Swipe from the edge to go back doesn&#39;t work</span><span equipo-spec-doing>Reading NavigationStack.swift</span></span>`, "<small equipo-count data-count>2</small>", "<small equipo-count data-count data-attention>1</small>"}, []string{"attempt", "In review", "Woodstar", "/bin/bash", "cat ios", "equipo-spec-panel", "<details", "<li"}},
33 {railView{Specialists: []railSpecialist{{Key: "engineering", Icon: "code", CopyKey: "nav.engineering", Task: &task, Step: &second, Now: now}}}, []string{"<span equipo-spec-attempt>attempt 2</span>"}, nil},
34 {railView{}, []string{"<small equipo-count data-count>Unavailable</small>"}, nil},
35 } {
36 data := pageData{Nav: railItems, Rail: tc.rail}
37 order := []string{`id="nav-conversation"`, `id="nav-projects"`, `id="nav-tasks"`, `id="nav-needs-you"`}
38 var out bytes.Buffer
39 if err := pages["conversation"].ExecuteTemplate(&out, "region:rail", data); err != nil {
40 t.Fatal(err)
41 }
42 for i := 1; i < len(order); i++ {
43 if strings.Index(out.String(), order[i-1]) > strings.Index(out.String(), order[i]) {
44 t.Fatalf("%s after %s", order[i-1], order[i])
45 }
46 }
47 for _, want := range tc.want {
48 if !strings.Contains(out.String(), want) {
49 t.Fatalf("%q missing: %s", want, out.String())
50 }
51 }
52 for _, not := range tc.not {
53 if strings.Contains(out.String(), not) {
54 t.Fatalf("%q shown: %s", not, out.String())
55 }
56 }
57 }
58}
59
60func TestChatTaskKinds(t *testing.T) {
61 for _, kind := range []string{"bug", "feature", "rendered_change", "recommendation", "investigation"} {
62 if pageCopy["task.kind."+kind] == "" {
63 t.Errorf("missing chat task kind %s", kind)
64 }
65 }
66}
67