forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_task_test.go
More file actions
52 lines (42 loc) · 1.14 KB
/
list_task_test.go
File metadata and controls
52 lines (42 loc) · 1.14 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package tasklog
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestListTaskCallsDoneWhenComplete(t *testing.T) {
task := NewListTask("example")
task.Complete()
select {
case update, ok := <-task.Updates():
assert.Equal(t, "example: ...", update.S)
assert.True(t, ok,
"tasklog: expected Updates() to remain open")
default:
t.Fatal("tasklog: expected update from *ListTask")
}
select {
case update, ok := <-task.Updates():
assert.False(t, ok,
"git/githistory.log: unexpected *ListTask.Update(): %s", update)
default:
t.Fatal("tasklog: expected *ListTask.Updates() to be closed")
}
}
func TestListTaskWritesEntries(t *testing.T) {
task := NewListTask("example")
task.Entry("1")
select {
case update, ok := <-task.Updates():
assert.True(t, ok,
"tasklog: expected ListTask.Updates() to remain open")
assert.Equal(t, "1\n", update.S)
default:
t.Fatal("tasklog: expected task.Updates() to have an update")
}
}
func TestListTaskIsNotThrottled(t *testing.T) {
task := NewListTask("example")
throttled := task.Throttled()
assert.False(t, throttled,
"tasklog: expected *ListTask to be Throttle()-d")
}