tests/testthat/test_scrape.R

context('test scrape')

test_that('scrape checks errors', {
    data(zctaRel)
    setApiKey('testing')
    testScheduler <- scheduler()
    zctaRel $RURAL <- log(zctaRel $COPOP) < 10
    expect_error(scrape(testScheduler, c('GEOID', 'ZCTA5'), strata='RURAL', sampleFrame=zctaRel),
                 'strata must remain nested')
    expect_error(scrape(testScheduler, 'GEOID', size=c(1, 1, 1)), 'id must exist for all stages')
    expect_error(scrape(testScheduler, 'GEOID', size=1), 'id of last stage must be identical to "id"')
})
cmarmstrong/wunderscraper documentation built on July 17, 2019, 8:19 p.m.