Skip to content

Commit ad545f3

Browse files
committed
test(acceptance): update fake github server to return the endCursor
This corresponds to the change in the previous commit and will bridge the gap between the test and new data format.
1 parent fcbf7d4 commit ad545f3

File tree

1 file changed

+16
-6
lines changed
  • spec/acceptance/github-server

1 file changed

+16
-6
lines changed

spec/acceptance/github-server/web.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,22 @@ def graphql_org_query(query)
113113

114114
edges = []
115115
cursor_flag = cursor.nil?
116+
end_cursor = nil
116117
result.each do |user, role|
117-
next if !cursor_flag && Base64.strict_encode64(user) != cursor
118-
edges << { "node" => { "login" => user }, "role" => role, "cursor" => Base64.strict_encode64(user) } if cursor_flag
118+
end_cursor = Base64.strict_encode64(user)
119+
next if !cursor_flag && end_cursor != cursor
120+
edges << { "node" => { "login" => user }, "role" => role} if cursor_flag
119121
cursor_flag = true
120122
break if edges.size >= first
121123
end
122124

123125
{
124126
"organization" => {
125127
"membersWithRole" => {
126-
"edges" => edges
128+
"edges" => edges,
129+
"pageInfo" => {
130+
"endCursor" => end_cursor
131+
}
127132
}
128133
}
129134
}
@@ -144,17 +149,22 @@ def graphql_pending_query(query)
144149

145150
edges = []
146151
cursor_flag = cursor.nil?
152+
end_cursor = nil
147153
result.each do |user|
148-
next if !cursor_flag && Base64.strict_encode64(user) != cursor
149-
edges << { "node" => { "login" => user }, "cursor" => Base64.strict_encode64(user) } if cursor_flag
154+
end_cursor = Base64.strict_encode64(user)
155+
next if !cursor_flag && end_cursor != cursor
156+
edges << { "node" => { "login" => user } } if cursor_flag
150157
cursor_flag = true
151158
break if edges.size >= first
152159
end
153160

154161
{
155162
"organization" => {
156163
"pendingMembers" => {
157-
"edges" => edges
164+
"edges" => edges,
165+
"pageInfo" => {
166+
"endCursor" => end_cursor
167+
}
158168
}
159169
}
160170
}

0 commit comments

Comments
 (0)