Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions test/fbe/test_github_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,26 @@ def test_total_releases_published_dont_count_after_till
assert_equal(1, result['releases'], "a release published after the till moment is counted, seed: #{seed}")
end

def test_total_releases_published_reads_past_the_first_page
WebMock.disable_net_connect!
graph = Fbe::Graph.new(token: 'fake')
pages = [
[{ 'isDraft' => false, 'publishedAt' => '2025-04-01T00:00:00Z' }, { 'hasNextPage' => true, 'endCursor' => 'C1' }],
[{ 'isDraft' => false, 'publishedAt' => '2025-03-01T00:00:00Z' }, { 'hasNextPage' => false, 'endCursor' => nil }]
]
queries = []
graph.define_singleton_method(:query) do |qry|
queries << qry
node, info = pages.shift
{ 'repository' => { 'releases' => { 'nodes' => [node], 'pageInfo' => info } } }
end
result = graph.total_releases_published(
'foo', 'bar', Time.parse('2025-01-01T00:00:00Z'), till: Time.parse('2025-05-01T00:00:00Z')
)
assert_equal(2, result['releases'], 'the releases of the second page are not counted')
assert_includes(queries.last, 'after: "C1"')
end

def test_total_releases_published_stops_paging_at_since_when_till_is_later
WebMock.disable_net_connect!
seed = Random.new_seed
Expand Down
Loading