Skip to content

Commit 171e66a

Browse files
committed
update tests
1 parent 3d81b39 commit 171e66a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

models/issue_milestone_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,20 @@ func TestGetMilestonesByRepoID(t *testing.T) {
7474
milestones, err := GetMilestonesByRepoID(repo.ID, state)
7575
assert.NoError(t, err)
7676

77-
var n = repo.NumOpenMilestones
77+
var n int
7878

79-
if state == api.StateClosed {
79+
switch state {
80+
case api.StateClosed:
8081
n = repo.NumClosedMilestones
82+
83+
case api.StateAll:
84+
n = repo.NumMilestones
85+
86+
case api.StateOpen:
87+
fallthrough
88+
89+
default:
90+
n = repo.NumOpenMilestones
8191
}
8292

8393
assert.Len(t, milestones, n)
@@ -86,11 +96,14 @@ func TestGetMilestonesByRepoID(t *testing.T) {
8696
}
8797
}
8898
test(1, api.StateOpen)
99+
test(1, api.StateAll)
89100
test(1, api.StateClosed)
90101
test(2, api.StateOpen)
102+
test(2, api.StateAll)
91103
test(2, api.StateClosed)
92104
test(3, api.StateOpen)
93105
test(3, api.StateClosed)
106+
test(3, api.StateAll)
94107

95108
milestones, err := GetMilestonesByRepoID(NonexistentID, api.StateOpen)
96109
assert.NoError(t, err)

0 commit comments

Comments
 (0)