Skip to content

Commit 1e26429

Browse files
committed
fix tests for #124
1 parent 9c48354 commit 1e26429

6 files changed

+14
-14
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: repometrics
22
Title: Metrics for Your Code Repository
3-
Version: 0.1.6.142
3+
Version: 0.1.6.143
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/repometrics",
99
"issueTracker": "https://github.com/ropensci-review-tools/repometrics/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.6.142",
11+
"version": "0.1.6.143",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

tests/testthat/helper-rm-data.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ mock_rm_data <- function (repo = TRUE) {
4242

4343
# rm-data-user:
4444
logins <- c ("gaborcsardi", "hfrick", "mpadge")
45-
ended_at <- as.POSIXct ("2024-01-01T00:00:00")
45+
end_date <- as.POSIXct ("2024-01-01T00:00:00")
4646
for (login in logins) {
4747
prfx <- paste0 ("gh_user", match (login, logins), "_")
4848
pars <- list (
4949
login = login,
5050
n_per_page = 1L,
51-
ended_at = ended_at,
51+
end_date = end_date,
5252
nyears = 1
5353
)
5454
general <- httptest2::with_mock_dir (paste0 (prfx, "general"), {
@@ -81,9 +81,9 @@ mock_rm_data <- function (repo = TRUE) {
8181
writeLines (desc, desc_path)
8282

8383
# test-cm-metrics.R only tests cran downloads for this one date:
84-
end_date <- as.Date ("2024-08-01")
84+
end_date_cran <- as.Date ("2024-08-01")
8585
dl <- httptest2::with_mock_dir ("cran_dl", {
86-
cm_metric_cran_downloads (path, end_date = end_date)
86+
cm_metric_cran_downloads (path, end_date = end_date_cran)
8787
})
8888

8989
# The return full mocked data set:
@@ -104,7 +104,7 @@ mock_rm_data <- function (repo = TRUE) {
104104
pars <- list (
105105
login = login,
106106
n_per_page = 1L,
107-
ended_at = ended_at,
107+
end_date = end_date,
108108
nyears = 1
109109
)
110110

tests/testthat/helper-user-relations.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mock_user_rel_data <- function () {
4646
date = rep (timestamp, 2L)
4747
)
4848
attr (commit_cmt, "started_at") <- timestamp_minus_year
49-
attr (commit_cmt, "ended_at") <- timestamp
49+
attr (commit_cmt, "end_date") <- timestamp
5050

5151
issues <- data.frame (
5252
opened_at = rep (timestamp, 2L),
@@ -59,7 +59,7 @@ mock_user_rel_data <- function () {
5959
repo_languages = I (c ("R", "C"))
6060
)
6161
attr (issues, "started_at") <- timestamp_minus_year
62-
attr (issues, "ended_at") <- timestamp
62+
attr (issues, "end_date") <- timestamp
6363

6464
issue_cmts <- data.frame (
6565
org_repo = commits$repo,

tests/testthat/test-data-rm-gh-user.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ test_that ("repometrics_data_user fn", {
8080
dat_mocked <- mock_rm_data (repo = FALSE)
8181

8282
login <- "gaborcsardi"
83-
ended_at <- as.POSIXct ("2024-01-01T00:00:00")
83+
end_date <- as.POSIXct ("2024-01-01T00:00:00")
8484

8585
dat <- repometrics_data_user (
8686
login = login,
8787
n_per_page = 1L,
88-
ended_at = ended_at,
88+
end_date = end_date,
8989
nyears = 1
9090
)
9191
expect_identical (dat, dat_mocked$gaborcsardi)

tests/testthat/test-data-rm.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ test_that ("repometrics data full", {
66

77
data_repo <- repometrics_data_repo (path, num_cores = 1L)
88

9-
ended_at <- as.POSIXct ("2024-01-01T00:00:00")
9+
end_date <- as.POSIXct ("2024-01-01T00:00:00")
1010
logins <- data_repo$rm$contribs_from_gh_api$login
1111

1212
data_ctbs <- lapply (logins, function (login) {
1313
repometrics_data_user (
1414
login = login,
1515
n_per_page = 1L,
16-
ended_at = ended_at,
16+
end_date = end_date,
1717
nyears = 1
1818
)
1919
})
@@ -22,7 +22,7 @@ test_that ("repometrics data full", {
2222
data <- repometrics_data (
2323
path,
2424
num_cores = 1L,
25-
ended_at = ended_at,
25+
end_date = end_date,
2626
nyears = 1
2727
)
2828

0 commit comments

Comments
 (0)