Skip to content

Commit

Permalink
Fix tests further...
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed May 7, 2024
1 parent 13361a6 commit 77f52bc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/helper-expect-tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ expect_users_table <- function(get_user_object, one_user = FALSE) {
}
}

expect_files_table <- function(files_object) {
expect_files_table <- function(files_object, add_col = NULL) {
expect_s3_class(files_object, "data.frame")
expect_named(
files_object,
c("repo_name", "repo_id", "organization",
"file_path", "file_content", "file_size",
"repo_url")
"repo_url", add_col)
)
expect_type(files_object$file_size, "integer")
expect_gt(nrow(files_object), 0)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-04-GitHost.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ test_that("`pull_files()` pulls files in the table format", {
file_path = "LICENSE"
)
)
expect_files_table(gh_files_table)
expect_files_table(gh_files_table, add_col = "api_url")
test_mocker$cache(gh_files_table)
})

Expand Down Expand Up @@ -245,7 +245,7 @@ test_that("`pull_files()` pulls files in the table format", {
file_path = "README.md"
)
)
expect_files_table(gl_files_table)
expect_files_table(gl_files_table, add_col = "api_url")
test_mocker$cache(gl_files_table)
})

Expand All @@ -255,7 +255,7 @@ test_that("`pull_files()` pulls two files in the table format", {
file_path = c("meta_data.yaml", "README.md")
)
)
expect_files_table(gl_files_table)
expect_files_table(gl_files_table, add_col = "api_url")
expect_true(
all(c("meta_data.yaml", "README.md") %in% gl_files_table$file_path)
)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-05-GitHostGitHub.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ test_that("pull_files for GitHub works", {
)
)
expect_files_table(
gh_files_table
gh_files_table,
add_col = "api_url"
)
})

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-05-GitHostGitLab.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ test_that("pull_files for GitLab works", {
)
)
expect_files_table(
gl_files_table
gl_files_table, add_col = "api_url"
)
})
2 changes: 1 addition & 1 deletion tests/testthat/test-07-GitStats.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test_that("get_files works properly", {
verbose = FALSE
)
expect_files_table(
files_table
files_table, add_col = "api_url"
)
test_mocker$cache(files_table)
})
Expand Down

0 comments on commit 77f52bc

Please sign in to comment.