Skip to content

Commit

Permalink
Follow up and try to fix coverage patch job.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed Oct 18, 2024
1 parent 01a4842 commit ae3f066
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 40 deletions.
17 changes: 0 additions & 17 deletions tests/testthat/_snaps/01-get_repos-GitHub.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,3 @@
Output
[1] "\n query GetReposByOrg($login: String! $repoCursor: String!) {\n repositoryOwner(login: $login) {\n ... on Organization {\n \n repositories(first: 100 after: $repoCursor) {\n totalCount\n pageInfo {\n endCursor\n hasNextPage\n }\n nodes {\n repo_id: id\n repo_name: name\n default_branch: defaultBranchRef {\n name\n }\n stars: stargazerCount\n forks: forkCount\n created_at: createdAt\n last_activity_at: pushedAt\n languages (first: 5) { nodes {name} }\n issues_open: issues (first: 100 states: [OPEN]) {\n totalCount\n }\n issues_closed: issues (first: 100 states: [CLOSED]) {\n totalCount\n }\n organization: owner {\n login\n }\n repo_url: url\n }\n }\n \n }\n }\n }"

# `prepare_repos_table()` prepares minimum version of repos table

Code
gh_repos_by_code_table_min <- test_rest_github$prepare_repos_table(repos_list = test_mocker$
use("gh_repos_by_code_tailored_min"), output = "table_min")
Message
i Preparing repositories table...

# `get_repos_contributors()` works on GitHost level

Code
gh_repos_with_contributors <- github_testhost_priv$get_repos_contributors(
repos_table = test_mocker$use("gh_repos_table_with_platform"), verbose = TRUE,
progress = FALSE)
Message
i [Host:GitHub][Engine:REST] Pulling contributors...

8 changes: 0 additions & 8 deletions tests/testthat/_snaps/01-get_repos-GitLab.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@
Output
[1] "\n query GetReposByOrg($org: ID! $repo_cursor: String!) {\n group(fullPath: $org) {\n projects(first: 100 after: $repo_cursor) {\n \n count\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n repo_id: id\n repo_name: name\n repo_path: path\n ... on Project {\n repository {\n rootRef\n }\n }\n stars: starCount\n forks: forksCount\n created_at: createdAt\n last_activity_at: lastActivityAt\n languages {\n name\n }\n issues: issueStatusCounts {\n all\n closed\n opened\n }\n namespace {\n path\n }\n repo_url: webUrl\n }\n }\n }\n }\n }"

# REST client prepares table from GitLab repositories response

Code
gl_repos_by_code_table <- test_rest_gitlab$prepare_repos_table(repos_list = test_mocker$
use("gl_repos_by_code_tailored"))
Message
i Preparing repositories table...

5 changes: 5 additions & 0 deletions tests/testthat/_snaps/get_commits-GitStats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# get_commits_stats returns error when no commits

x No commits found in GitStats storage.
i Run first `get_commits()`.

19 changes: 8 additions & 11 deletions tests/testthat/test-01-get_repos-GitHub.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,10 @@ test_that("`prepare_repos_table()` prepares repos table", {
})

test_that("`prepare_repos_table()` prepares minimum version of repos table", {
expect_snapshot(
gh_repos_by_code_table_min <- test_rest_github$prepare_repos_table(
repos_list = test_mocker$use("gh_repos_by_code_tailored_min"),
output = "table_min"
)
gh_repos_by_code_table_min <- test_rest_github$prepare_repos_table(
repos_list = test_mocker$use("gh_repos_by_code_tailored_min"),
output = "table_min",
verbose = FALSE
)
expect_repos_table(
gh_repos_by_code_table_min,
Expand Down Expand Up @@ -468,12 +467,10 @@ test_that("`get_repos_contributors()` works on GitHost level", {
"rest_engine$get_repos_contributors",
test_mocker$use("gh_repos_with_contributors")
)
expect_snapshot(
gh_repos_with_contributors <- github_testhost_priv$get_repos_contributors(
repos_table = test_mocker$use("gh_repos_table_with_platform"),
verbose = TRUE,
progress = FALSE
)
gh_repos_with_contributors <- github_testhost_priv$get_repos_contributors(
repos_table = test_mocker$use("gh_repos_table_with_platform"),
verbose = FALSE,
progress = FALSE
)
expect_repos_table(
gh_repos_with_contributors,
Expand Down
7 changes: 3 additions & 4 deletions tests/testthat/test-01-get_repos-GitLab.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,9 @@ test_that("`tailor_repos_response()` tailors precisely `repos_list`", {
})

test_that("REST client prepares table from GitLab repositories response", {
expect_snapshot(
gl_repos_by_code_table <- test_rest_gitlab$prepare_repos_table(
repos_list = test_mocker$use("gl_repos_by_code_tailored")
)
gl_repos_by_code_table <- test_rest_gitlab$prepare_repos_table(
repos_list = test_mocker$use("gl_repos_by_code_tailored"),
verbose = FALSE
)
expect_repos_table(
gl_repos_by_code_table
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-get_commits-GitStats.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ test_gitstats <- create_test_gitstats(
inject_commits = "commits_table"
)

test_that("get_commits_stats returns error when no commits", {
test_gitstats <- create_test_gitstats()
expect_snapshot_error(
get_commits_stats(test_gitstats)
)
})

test_that("get_commits_stats prepares table with statistics on commits", {
commits_stats <- get_commits_stats(test_gitstats)
expect_s3_class(commits_stats, "commits_stats")
Expand Down

0 comments on commit ae3f066

Please sign in to comment.