Skip to content

Commit

Permalink
Merge pull request #89 from jkeirstead/tests
Browse files Browse the repository at this point in the history
Additional tests
  • Loading branch information
GuangchuangYu committed Sep 1, 2020
2 parents 561f683 + 12ef666 commit 6d2bef7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ Suggests:
roxygen2,
testthat (>= 2.1.0)
VignetteBuilder: knitr
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
Encoding: UTF-8
21 changes: 21 additions & 0 deletions tests/testthat/test-scholar.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ test_that("get_complete_authors works (vector)", {
result = get_complete_authors(id, pubs$pubid[1:2])
expect_equal(length(result), 2)
})

test_that("get_citation_history works", {
skip_on_cran()
skip_if_offline()
expect_is(h <- get_citation_history("xJaxiEEAAAAJ"), 'data.frame')
expect_equal(names(h), c("year", "cites"))
})

test_that("get_profile works", {
skip_on_cran()
skip_if_offline()
id <- 'xJaxiEEAAAAJ'
authorlist <- scholar::get_publications(id)$author
author <- scholar::get_profile(id)$name
author_position(authorlist, author)

expect_is(h <- get_citation_history("xJaxiEEAAAAJ"), 'data.frame')
expect_equal(names(h), c("year", "cites"))
})


# Here we could add tests that use cached data
# context("scholar tests - offline")

0 comments on commit 6d2bef7

Please sign in to comment.