| 1 | package cli |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/charmbracelet/colorprofile" |
| 8 | ) |
| 9 | |
| 10 | func TestRenderBranchTreeStylesVisualWeight(t *testing.T) { |
| 11 | oldColor := activeColorProfile |
| 12 | activeColorProfile = colorprofile.ANSI256 |
| 13 | defer func() { activeColorProfile = oldColor }() |
| 14 | |
| 15 | got := renderBranchTree("branches:\n├─ 0601-030143.318 你是谁 3 turns\n│ └─ 0601-033937.165 JSON response: success 1 turn\n└─ 0601-035153.346 JSON array 1 turn current") |
| 16 | for _, want := range []string{ |
| 17 | accent("branches:"), |
| 18 | dim("├─ "), |
| 19 | dim("0601-030143.318"), |
| 20 | dim("│ └─ "), |
| 21 | dim("0601-033937.165"), |
| 22 | dim("3 turns"), |
| 23 | accent("current"), |
| 24 | } { |
| 25 | if !strings.Contains(got, want) { |
| 26 | t.Fatalf("styled tree missing %q:\n%q", want, got) |
| 27 | } |
| 28 | } |
| 29 | if strings.Contains(got, "*") { |
| 30 | t.Fatalf("styled tree should not use a duplicate current marker:\n%q", got) |
| 31 | } |
| 32 | } |
| 33 |