|
|
@@ -56,6 +56,25 @@ func TestLineText(t *testing.T) {
|
|
|
assert.Equal(t, out, "\x1b[31m . id Text Status 0.0s\n\x1b[0m")
|
|
|
}
|
|
|
|
|
|
+func TestLineTextSingleEvent(t *testing.T) {
|
|
|
+ now := time.Now()
|
|
|
+ ev := Event{
|
|
|
+ ID: "id",
|
|
|
+ Text: "Text",
|
|
|
+ Status: Done,
|
|
|
+ StatusText: "Status",
|
|
|
+ startTime: now,
|
|
|
+ spinner: &spinner{
|
|
|
+ chars: []string{"."},
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ lineWidth := len(fmt.Sprintf("%s %s", ev.ID, ev.Text))
|
|
|
+
|
|
|
+ out := lineText(ev, "", 50, lineWidth, true)
|
|
|
+ assert.Equal(t, out, "\x1b[34m . id Text Status 0.0s\n\x1b[0m")
|
|
|
+}
|
|
|
+
|
|
|
func TestErrorEvent(t *testing.T) {
|
|
|
w := &ttyWriter{
|
|
|
events: map[string]Event{},
|