-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3286b48
commit dc5d94d
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Tests for add_logo functions ------------------------------------------------- | ||
|
||
test_that("add_logo works as expected", { | ||
create_readme_file() | ||
|
||
add_logo(repo = "katilingban/pakete") | ||
|
||
expect_snapshot_file( | ||
path = "README.Rmd", | ||
name = "README.Rmd" | ||
) | ||
|
||
remove_readme_file() | ||
}) | ||
|
||
|
||
test_that("add_logo with logo present works as expected", { | ||
create_readme_file() | ||
|
||
add_logo(repo = "katilingban/pakete") | ||
|
||
add_logo(repo = "katilingban/pakete") | ||
|
||
expect_snapshot_file( | ||
path = "README.Rmd", | ||
name = "README.Rmd" | ||
) | ||
|
||
remove_readme_file() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Tests for utility functions -------------------------------------------------- | ||
|
||
test_that("get_github_repository works as expected", { | ||
expect_error(get_github_repository()) | ||
}) | ||
|
||
|
||
test_that("get_readme_path works as expected", { | ||
create_readme_file() | ||
|
||
rmarkdown::render("README.Rmd") | ||
remove_readme_file() | ||
|
||
expect_identical(get_readme_path(), "README.md") | ||
|
||
file.remove("README.md") | ||
|
||
expect_error(get_readme_path()) | ||
}) | ||
|
||
|
||
test_that("insert_readme_badge_text works as expected", { | ||
expect_error(insert_readme_badge_text()) | ||
expect_error( | ||
insert_readme_badge_text( | ||
badge_text = "[](https://www.repostatus.org/#wip)" | ||
) | ||
) | ||
|
||
create_readme_file() | ||
add_badge_status("wip", path = "README.Rmd") | ||
readme_lines <- readLines("README.Rmd") | ||
|
||
expect_warning( | ||
insert_readme_badge_text( | ||
badge_text = "[](https://www.repostatus.org/#wip)", | ||
readme_lines = readme_lines | ||
) | ||
) | ||
|
||
remove_readme_file() | ||
}) |