tests/testthat/test-build_filter.R

test_that("reducing transformation from list to value works", {
  filter <- tibble::tribble(
    ~column, ~operator, ~value, ~transformation,
    "event_url", "matches",
    list("^/someurl"), list("to_path")
  )

  filter <- build_filter(filter, "and")

  expect_equal(filter$conditions[[1]]$conditions[[1]]$transformation_id %>%
                 class(),
               "character")
})

test_that("reducing value from list to value works", {
  filter <- tibble::tribble(
    ~column, ~operator, ~value, ~transformation,
    "event_url", "matches",
    list("^/someurl"), "to_path"
  )

  filter <- build_filter(filter, "and")

  expect_equal(filter$conditions[[1]]$conditions[[1]]$condition$value %>%
                 class(),
               "character")
})

Try the piwikproR package in your browser

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

piwikproR documentation built on Sept. 1, 2022, 5:07 p.m.