From 8e61823ec403b661359373f8f8b0c9a7c9ea368d Mon Sep 17 00:00:00 2001 From: Morlinest Date: Mon, 28 Aug 2017 11:17:45 +0200 Subject: Fix tests code to prevent some runtime errors (#2381) * Fix tests code to prevent some runtime errors * Reduce nesting --- models/admin_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'models/admin_test.go') diff --git a/models/admin_test.go b/models/admin_test.go index 7fb8f1d0a0..b4383cb2d3 100644 --- a/models/admin_test.go +++ b/models/admin_test.go @@ -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) { -- cgit v1.2.3