tests/testthat/test_tidy_stats_to_data_frame.R

# Setup -------------------------------------------------------------------

expected_df <- readr::read_csv("../data/main_df.csv")

# Drop the spec_tbl_df class
expected_df <- expected_df[]

tolerance <- 0.001

# tidy_stats_to_data_frame() ----------------------------------------------

test_that("tidy stats to data frame works", {
  statistics <- read_stats("../data/main.json")

  df <- tidy_stats_to_data_frame(statistics)

  expect_equal(df, expected_df, tolerance = tolerance)
})

Try the tidystats package in your browser

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

tidystats documentation built on Oct. 17, 2023, 1:06 a.m.