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 "strings"
6 "testing"
7)
8
9func TestAccessGrantedNoteAndBroadLabel(t *testing.T) {
10 c := wire.Card{Kind: wire.CardAccess, State: wire.CardResolved, Access: &wire.AccessRequest{Target: "carlos", State: "approved"}}
11 v := cardView(c, nil, nil)
12 if !strings.Contains(v.Note, "Access granted") || !strings.Contains(v.Note, "carlos") {
13 t.Fatal("missing grant note", v.Note)
14 }
15 if !strings.Contains(v.AccessTarget, "Everything in carlos") {
16 t.Fatal("namespace label not broad", v.AccessTarget)
17 }
18}
19
20func TestAccessPostFinalCopy(t *testing.T) {
21 for _, state := range []string{"not_owned", "already"} {
22 c := wire.Card{Kind: wire.CardAccess, State: wire.CardResolved, Access: &wire.AccessRequest{Target: "carlos/platform", State: state}}
23 v := cardView(c, nil, nil)
24 if strings.Contains(v.Line, "Ask again") || strings.HasPrefix(v.Line, "access.") {
25 t.Fatal("outcome lacks final copy", v.Line)
26 }
27 if state == "not_owned" && !strings.Contains(v.Line, "owner of carlos") {
28 t.Fatal("owner refusal lacks namespace", v.Line)
29 }
30 if state == "already" && v.Line != "Equipo already has access." {
31 t.Fatal("existing access unclear", v.Line)
32 }
33 }
34}
35