Skip to content

Commit

Permalink
upkeep: generate_package_table gains some simple unit tests (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhoffa authored Apr 9, 2024
1 parent 8270e91 commit a0f26b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pacta.sit.rep
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9001
Version: 0.0.0.9002
Authors@R:
person("Jackson", "Hoffart", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-8600-5042"))
Expand Down
21 changes: 19 additions & 2 deletions tests/testthat/test-generate_package_table.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
test_that("multiplication works", {
expect_equal(2 * 2, 4)
library(testthat)
library(dplyr)

pacta_r_package_path <- "https://github.com/RMI-PACTA/pacta.r.package"

test_that("returns correct structure and data", {
result <- generate_package_table(pacta_r_package_path)
expected_names <- c("Repo", "Lifecycle", "Status", "Latest_SHA", "Maintainer")

expect_true(tibble::is_tibble(result))
expect_equal(ncol(result), 5)
expect_true(all(expected_names %in% names(result)))
})

test_that("handles empty input", {
empty_input <- character(0)
result <- generate_package_table(empty_input)

expect_true(tibble::is_tibble(result) && nrow(result) == 0)
})

0 comments on commit a0f26b1

Please sign in to comment.