-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enforce some length stability opens #183
- Loading branch information
Showing
2 changed files
with
23 additions
and
5 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
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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
test_that("Crossref metadata can be read in", { | ||
dois <- tu_dois()[2:5] | ||
res <- cr_works2(dois) | ||
expect_equal(nrow(res), length(dois)) | ||
# wrapped cr api calls ==== | ||
|
||
dois <- tu_dois()[2:5] | ||
|
||
test_that("Crossref metadata can be read in", { | ||
# testthat does not seem to know about vctrs equality | ||
# https://github.com/r-lib/testthat/issues/1349 | ||
expect_true(all(biblids::as_doi(res$doi) == biblids::as_doi(dois))) | ||
expect_true( | ||
all(biblids::as_doi(cr_works2(dois)$doi) == biblids::as_doi(dois)) | ||
) | ||
}) | ||
|
||
test_that("cr_works2 is length-stable", { | ||
expect_equal(nrow(cr_works2(dois)), length(dois)) | ||
expect_equal(nrow(cr_works2(dois[1])), 1) | ||
skip("Length instability in columns cannot be repaired by wrapper.") | ||
# blocked by https://github.com/subugoe/metacheck/issues/183 | ||
expect_equal(ncol(cr_works2(dois)), ncol(cr_works2(dois[1]))) | ||
}) | ||
|
||
test_that("Bad DOIs throw error", { | ||
skip("Not implemented") | ||
expect_equal(1, 1) | ||
}) |