tests/testthat/test-get_yieldamount.R

test_that("Structure output is correct for yield amount endpoint", {
  yieldamount <- get_yieldamount(apiKey = '664fbadd34e6c2ca75235709f9ede2bd', foodCode = 57)
  
  expect_equal(tibble::is_tibble(yieldamount), TRUE)
  expect_equal(nrow(yieldamount), 2)
  
  col_types <- c('double', 'integer', 'character', 'character')
  expect_equal(col_types, as.vector(sapply(yieldamount, typeof)))})

Try the nutrientr package in your browser

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

nutrientr documentation built on March 18, 2022, 6:27 p.m.