From 1c6144a13e49ae4c4531741aceff2e71c16ddc4c Mon Sep 17 00:00:00 2001 From: tan Date: Sat, 21 Jun 2025 05:50:05 +0530 Subject: [PATCH 1/2] fix compare tests The compare tests failed if the commits on master branch were merge commits. This fixes the tests by checking the latest commit on master branch and changing the test conditions accordingly. --- test/read_only_api_tests.jl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/read_only_api_tests.jl b/test/read_only_api_tests.jl index 03e6e65..68cc95d 100644 --- a/test/read_only_api_tests.jl +++ b/test/read_only_api_tests.jl @@ -86,10 +86,21 @@ end @test hasghobj("master", first(branches(ghjl; auth = auth))) # test GitHub.compare - @test compare(ghjl, "master", "master~"; auth = auth).behind_by == 1 - let comparison = compare(ghjl, "master~", "master"; auth = auth) - @test comparison.ahead_by == 1 - @test length(comparison.commits) == 1 + # check if the latest commit it a merge commit + latest_commit = GitHub.branch(ghjl, "master"; auth=auth).commit + is_latest_commit_merge = length(latest_commit.parents) > 1 + if is_latest_commit_merge + @test compare(ghjl, "master", "master~"; auth = auth).behind_by >= 1 + let comparison = compare(ghjl, "master~", "master"; auth = auth) + @test comparison.ahead_by >= 1 + @test length(comparison.commits) >= 1 + end + else + @test compare(ghjl, "master", "master~"; auth = auth).behind_by == 1 + let comparison = compare(ghjl, "master~", "master"; auth = auth) + @test comparison.ahead_by == 1 + @test length(comparison.commits) == 1 + end end # test GitHub.file, GitHub.directory, GitHub.readme, GitHub.permalink From ae7cf443f58554ad7b94cbf77a9175d091c0aea1 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Fri, 20 Jun 2025 20:36:57 -0400 Subject: [PATCH 2/2] Fix typo (Apply suggestions from code review) --- test/read_only_api_tests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/read_only_api_tests.jl b/test/read_only_api_tests.jl index 68cc95d..5acfbd3 100644 --- a/test/read_only_api_tests.jl +++ b/test/read_only_api_tests.jl @@ -86,7 +86,7 @@ end @test hasghobj("master", first(branches(ghjl; auth = auth))) # test GitHub.compare - # check if the latest commit it a merge commit + # check if the latest commit is a merge commit latest_commit = GitHub.branch(ghjl, "master"; auth=auth).commit is_latest_commit_merge = length(latest_commit.parents) > 1 if is_latest_commit_merge