Skip to content

Commit cae834a

Browse files
committed
Fix test
1 parent 82653ed commit cae834a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/integration/repo_fork_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
112112
req := NewRequest(t, "GET", "/user2/repo1/forks")
113113
resp := MakeRequest(t, req, http.StatusOK)
114114
htmlDoc := NewHTMLParser(t, resp.Body)
115-
assert.Equal(t, 0, htmlDoc.Find(forkItemSelector).Length())
115+
// current repository will also use class "flex-item" so we need to subtract 1
116+
assert.Equal(t, 0, htmlDoc.Find(forkItemSelector).Length()-1)
116117
})
117118

118119
t.Run("Logged in", func(t *testing.T) {
@@ -122,11 +123,13 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
122123
resp := user1Sess.MakeRequest(t, req, http.StatusOK)
123124
htmlDoc := NewHTMLParser(t, resp.Body)
124125
// since user1 is an admin, he can get both of the forked repositories
125-
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length())
126+
// current repository will also use class "flex-item" so we need to subtract 1
127+
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length()-1)
126128

127129
assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam2, user1))
128130
resp = user1Sess.MakeRequest(t, req, http.StatusOK)
129131
htmlDoc = NewHTMLParser(t, resp.Body)
130-
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length())
132+
// current repository will also use class "flex-item" so we need to subtract 1
133+
assert.Equal(t, 2, htmlDoc.Find(forkItemSelector).Length()-1)
131134
})
132135
}

0 commit comments

Comments
 (0)