tests/testthat/test_helpers.R

library(oRion)

context("helpers")

test_that("errors", {
  # no input
  expect_error(budgetType())
  expect_error(objective())
  expect_error(appType())
  expect_error(webType())
  expect_error(landingPage())
  expect_error(bidType())
  expect_error(appShowType())
  expect_error(deliveryType())
  expect_error(gender())
  expect_error(age())
  expect_error(netType())
  expect_error(buttonText())
  expect_error(switchIt())
  expect_error(audienceCreation())
  # wrong input
  expect_error(budgetType("error"))
  expect_error(objective("error"))
  expect_error(appType("error"))
  expect_error(webType("error"))
  expect_error(landingPage("error"))
  expect_error(bidType("error"))
  expect_error(appShowType("error"))
  expect_error(deliveryType("error"))
  expect_error(gender("error"))
  expect_error(age("error"))
  expect_error(netType("error"))
  expect_error(buttonText("error"))
  expect_error(switchIt("error"))
  expect_error(audienceCreation("error"))
  # too many arguements
  expect_error(buttonText(c("error1", "error2")))
})

test_that("outputs", {
  expect_equal(budgetType("daily"), "daily")
  expect_equal(objective("installs"), "1")
  expect_equal(appType("game"), "1")
  expect_equal(webType("ecommerce"), "2")
  expect_equal(landingPage("googlePlay"), landingPage("GOOGLEPlay"))
  expect_equal(bidType("CPM"), "4")
  expect_equal(appShowType("videoad"), "50003")
  expect_equal(deliveryType("standard"), "0")
  expect_equal(gender("all"), "0")
  expect_equal(age("40+"), "4")
  expect_equal(netType("wifi"), "1")
  expect_equal(buttonText("install"), "2")
  expect_equal(switchIt("off"), "0")
  expect_equal(audienceCreation("createnow"), "0")
})
JohnCoene/oRion documentation built on June 13, 2019, 12:44 p.m.