Skip to content

Commit a1e77d3

Browse files
committed
Fix #163
1 parent 7817248 commit a1e77d3

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

R/record_status.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#' @param staging Character string, file path to the JSON manifest
2626
#' of package versions in the Staging universe.
2727
#' Used to identify staged packages.
28-
#' Set to `NULL` (default) to ignore when processing the Community unvierse.
28+
#' Set to `NULL` (default) to ignore when processing the Community universe.
2929
#' @examples
3030
#' \dontrun{
3131
#' output <- tempfile()

man/record_status.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-record_status.R

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,60 @@ test_that("record_status() with dependency problems", {
101101
expect_false(status[[package]]$success)
102102
}
103103
})
104+
105+
test_that("record_status() with failed check on already staged package", {
106+
output <- tempfile()
107+
lines <- c(
108+
"[",
109+
" {",
110+
" \"package\": \"nanonext\",",
111+
" \"version_current\": \"1.0.0\",",
112+
" \"hash_current\": \"hash_1.0.0-modified\",",
113+
" \"version_highest\": \"1.0.0\",",
114+
" \"hash_highest\": \"hash_1.0.0\"",
115+
" }",
116+
"]"
117+
)
118+
versions <- tempfile()
119+
staging <- tempfile()
120+
on.exit(unlink(c(output, versions, staging), recursive = TRUE))
121+
writeLines(lines, versions)
122+
mock <- mock_meta_packages
123+
lines <- c(
124+
"[",
125+
" {",
126+
" \"package\": \"nanonext\",",
127+
" \"url\": \"https://github.com/r-lib/nanonext\",",
128+
" \"branch\": \"hash_1.0.0-modified\"",
129+
" }",
130+
"]"
131+
)
132+
writeLines(lines, staging)
133+
suppressMessages(
134+
record_status(
135+
versions = versions,
136+
staging = staging,
137+
mock = list(
138+
packages = mock,
139+
today = "2024-01-01"
140+
),
141+
output = output,
142+
verbose = TRUE
143+
)
144+
)
145+
expect_true(file.exists(output))
146+
status <- jsonlite::read_json(output, simplifyVector = TRUE)
147+
expect_equal(
148+
status$nanonext$versions,
149+
list(
150+
version_current = "1.0.0",
151+
hash_current = "hash_1.0.0-modified",
152+
version_highest = "1.0.0",
153+
hash_highest = "hash_1.0.0"
154+
)
155+
)
156+
# nanonext is already staged,
157+
# so failing checks should not longer penalize reverse dependencies.
158+
expect_null(status$mirai$dependencies)
159+
expect_null(status$crew$dependencies)
160+
})

0 commit comments

Comments
 (0)