tests/testthat/test-constructor.R

context("Constructor")

test_that("constructor works", {
    as.jsonstat("collection.json") %>%
        expect_class("jsonstat") %>%
        expect_class("jsonstat_collection")
    as.jsonstat("dataset.json") %>%
        expect_class("jsonstat") %>%
        expect_class("jsonstat_dataset")
    expect_error(as.jsonstat("notjsonstat.json"))

    expect_silent(as.jsonstat("oecd.json"))
    expect_silent(as.jsonstat("canada.json"))
    expect_silent(as.jsonstat("oecd-canada-col.json"))
    expect_silent(as.jsonstat("galicia.json"))
    expect_silent(as.jsonstat("order.json"))
    expect_silent(as.jsonstat("hierarchy.json"))
    expect_silent(as.jsonstat("us-gsp.json"))
    expect_silent(as.jsonstat("us-unr.json"))
    expect_silent(as.jsonstat("us-labor.json"))
    expect_silent(as.jsonstat("collection_sample.json"))
})

Try the rjstat package in your browser

Any scripts or data that you put into this service are public.

rjstat documentation built on Sept. 8, 2023, 5:10 p.m.