mirror of
https://github.com/go-gitea/gitea.git
synced 2024-05-11 05:55:29 +00:00
Fix tests code to prevent some runtime errors (#2381)
* Fix tests code to prevent some runtime errors * Reduce nesting
This commit is contained in:
@ -54,14 +54,16 @@ func TestNotices(t *testing.T) {
|
||||
|
||||
notices, err := Notices(1, 2)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, notices, 2)
|
||||
assert.Equal(t, int64(3), notices[0].ID)
|
||||
assert.Equal(t, int64(2), notices[1].ID)
|
||||
if assert.Len(t, notices, 2) {
|
||||
assert.Equal(t, int64(3), notices[0].ID)
|
||||
assert.Equal(t, int64(2), notices[1].ID)
|
||||
}
|
||||
|
||||
notices, err = Notices(2, 2)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, notices, 1)
|
||||
assert.Equal(t, int64(1), notices[0].ID)
|
||||
if assert.Len(t, notices, 1) {
|
||||
assert.Equal(t, int64(1), notices[0].ID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteNotice(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user