Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jennybc committed Jul 22, 2024
1 parent 4ccf25f commit 7074739
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/testthat/test-github.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
test_that("has_github_links() uses the target_repo, if provided", {
skip_if_no_git_user()
create_local_package()
local_interactive(FALSE)
use_git()

desc::desc_set_urls("https://github.com/OWNER/REPO")
desc::desc_set("BugReports", "https://github.com/OWNER/REPO/issues")

tr <- list(url = "[email protected]:OWNER/REPO.git")

expect_true(has_github_links(tr))
})

test_that("use_github_links populates empty URL field", {
skip_if_no_git_user()
local_interactive(FALSE)
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-utils-github.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ test_that("github_remotes() works", {
expect_true(is.na(grl$is_fork))
})

test_that("github_url_from_git_remotes() is idempotent", {
url <- "https://github.com/r-lib/usethis.git"
out <- github_url_from_git_remotes(url)
expect_equal(out, github_url_from_git_remotes(out))
})

# GitHub remote configuration --------------------------------------------------

test_that("we understand the list of all possible configs", {
Expand Down

0 comments on commit 7074739

Please sign in to comment.