-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathshow_projects_test.go
40 lines (28 loc) · 1.2 KB
/
show_projects_test.go
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
package integration
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestShowProjects(t *testing.T) {
repo, cleanup := makeDstaskRepo(t)
defer cleanup()
program := testCmd(repo)
output, exiterr, success := program("add", "one", "project:myproject")
assertProgramResult(t, output, exiterr, success)
output, exiterr, success = program("add", "two", "project:myproject")
assertProgramResult(t, output, exiterr, success)
output, exiterr, success = program("add", "three", "project:myproject")
assertProgramResult(t, output, exiterr, success)
output, exiterr, success = program("show-projects")
assertProgramResult(t, output, exiterr, success)
projects := unmarshalProjectArray(t, output)
assert.Equal(t, 0, projects[0].TasksResolved, "no tasks resolved")
assert.Equal(t, projects[0].Tasks, 3, "three tasks created")
output, exiterr, success = program("2", "done")
assertProgramResult(t, output, exiterr, success)
output, exiterr, success = program("show-projects")
assertProgramResult(t, output, exiterr, success)
projects = unmarshalProjectArray(t, output)
assert.Equal(t, 1, projects[0].TasksResolved, "no tasks resolved")
assert.Equal(t, 3, projects[0].Tasks, "three tasks created")
}