Skip to content

Commit

Permalink
add tests to catch page binding errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklucius committed Oct 19, 2016
1 parent 893b89f commit 6d441b7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/testthat/test-all.R
Expand Up @@ -192,13 +192,24 @@ test_that("format is not supported", {
expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml'))
})

test_that("read Socrata JSON with missing fields (issue 19)", {
test_that("read Socrata JSON with missing fields (issue 19 - bind within page)", {
## Define and test issue 19
df <- read.socrata("https://data.cityofchicago.org/resource/kn9c-c2s2.json")
expect_error(df <- read.socrata("https://data.cityofchicago.org/resource/kn9c-c2s2.json"), NA,
info = "https://github.com/Chicago/RSocrata/issues/19")
expect_equal(78, nrow(df), label="rows", info = "https://github.com/Chicago/RSocrata/issues/19")
expect_equal(9, ncol(df), label="columns", info = "https://github.com/Chicago/RSocrata/issues/19")
})

test_that("read Socrata JSON with missing fields (issue 19 - binding pages together)", {
## Define and test issue 19
expect_error(df <- read.socrata(paste0("https://data.smgov.net/resource/ia9m-wspt.json?",
"$where=incident_date>'2010-12-15'%20AND%20incident_date<'2011-01-15'"))
, NA, info = "https://github.com/Chicago/RSocrata/issues/19")
expect_equal(7927, nrow(df), label="rows", info = "https://github.com/Chicago/RSocrata/issues/19")
expect_equal(18, ncol(df), label="columns", info = "https://github.com/Chicago/RSocrata/issues/19")
})


context("Checks the validity of 4x4")

test_that("is 4x4", {
Expand Down

0 comments on commit 6d441b7

Please sign in to comment.