tests/testthat/test-json_utils.R

library(jutebag)
context("JSON utils")

# ============================================================================ #
# Tests
# ============================================================================ #

# ---------------------------------------------------------------------------- #
test_that("compact_json_str works as expected", {

  txt <- paste("{\n    \"sig_lev\": [0.05],\n    \"sidedness\":",
               "[\"two\"],\n    \"n_sims\": [1000]\n  }")

  ex <- "{\"sig_lev\":[0.05],\"sidedness\":[\"two\"],\"n_sims\":[1000]}"

  expect_equal(compact_json_str(txt), ex)
})

# ---------------------------------------------------------------------------- #
toniprice/jutebag documentation built on May 12, 2019, 4:39 a.m.