tests/testthat/test-operators.R

test_that("condition", {
  cond <- condition(list("$gte"='[ "$qty", 250 ]'), 30, 20)
  expect_equal(as.character(toJSON(cond)),
               '{"$cond":{"if":{"$gte":"[ \\\"$qty\\\", 250 ]"},"then":30,"else":20}}')
})

Try the mongopipe package in your browser

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

mongopipe documentation built on Jan. 20, 2021, 5:08 p.m.