Skip to content

Commit

Permalink
added dc_events test
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jan 3, 2020
1 parent 557b408 commit e585698
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/fixtures/dc_events.yml

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions tests/testthat/test-dc_events.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
context("dc_events")

test_that("dc_events works", {
vcr::use_cassette("dc_events", {
aa <- dc_events(limit = 5)
}, preserve_exact_body_bytes = TRUE)
expect_is(aa, "dc")
expect_equal(sort(names(aa)), c("data", "links", "meta"))
expect_is(aa$data, 'data.frame')
expect_null(aa$included)
expect_is(aa$meta, 'list')
expect_type(aa$meta$total, 'integer')
expect_type(aa$meta$totalPages, 'integer')
expect_is(aa$links, 'list')
})

test_that("dc_events fails well", {
expect_error(dc_events(ids = 3433), 'must be of class')
expect_error(dc_events(query = 5), 'must be of class')
expect_error(dc_events(limit = "foo"), 'must be of class')
expect_error(dc_events(page = "bar"), 'must be of class')
expect_error(dc_events(cursor = TRUE), 'must be of class')
})

0 comments on commit e585698

Please sign in to comment.