forked from fossteams/teams-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloading_test.go
More file actions
27 lines (24 loc) · 737 Bytes
/
Copy pathloading_test.go
File metadata and controls
27 lines (24 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"strings"
"testing"
"time"
)
func TestLoadingBarFrameWidthAndHead(t *testing.T) {
bar := loadingBarFrame(0, 10)
if len(bar) != 12 {
t.Fatalf("expected bar length 12, got %d", len(bar))
}
if !strings.Contains(bar, ">") {
t.Fatalf("expected bar to contain a head marker, got %q", bar)
}
}
func TestLoadingStatusTextIncludesMessageLimit(t *testing.T) {
mainText, secondaryText := loadingStatusText(25, time.Now().Add(-2*time.Second), 3)
if !strings.Contains(mainText, "25") {
t.Fatalf("expected main text to include the message limit, got %q", mainText)
}
if !strings.Contains(secondaryText, "Fetching recent messages from Teams") {
t.Fatalf("unexpected secondary text: %q", secondaryText)
}
}