Fix tests code to prevent some runtime errors (#2381)
* Fix tests code to prevent some runtime errors * Reduce nesting
This commit is contained in:
parent
ced50e0ec1
commit
8e61823ec4
15 changed files with 181 additions and 150 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue