tests/testthat/test_find.R

library(fbAdsInsightsR)

context("find-family")

test_that("findFields", {
  expect_error(findFields("error"))
  expect_is(findFields(), "character")
  expect_equal(length(findFields("getAny")), 90)
  expect_equal(length(findFields("getAccount")), 90)
  expect_equal(length(findFields("getAdset")), 90)
  expect_equal(length(findFields("getAd")), 90)
  expect_equal(length(findFields("getActivity")), 11)
  expect_equal(length(findFields("getCreative")), 22)
  expect_equal(length(findFields("grabCampaigns")), 15)
  expect_equal(length(findFields("grabAdsets")), 15)
  expect_equal(length(findFields("grabAds")), 15)
  expect_equal(length(findFields("checkStatus")), 5)
  expect_equal(length(findFields("listAccounts")), 53)
  expect_equal(length(findFields("listCreatives")), 22)
  expect_equal(length(findFields("listVideos")), 9)
  expect_equal(length(findFields("listImages")), 9)
  expect_equal(length(findFields("listBroadTargeting")), 8)
})

test_that("findParams", {
  expect_error(findFields("error"))
  expect_is(findParams(), "list")
  expect_equal(length(findParams("level")), 4)
  expect_equal(length(findParams("breakdowns")), 11)
  expect_equal(length(findParams("date.preset")), 15)
  expect_equal(length(findParams("time.increment")), 2)
  expect_equal(length(findParams("action.breakdowns")), 7)
  expect_equal(length(findParams("action.report.time")), 2)
  expect_equal(length(findParams("action.attribution.windows")), 6)
  expect_equal(length(findParams("subtype")), 11)
})
JohnCoene/fbadsinsightsr documentation built on May 28, 2019, 12:55 p.m.