Skip to content

Commit

Permalink
add unittests for handle_params
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Nov 29, 2022
1 parent 0b1d22a commit 3b93671
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/testthat/test-handle_params.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
test_that("handle_params", {
expect_equal(handle_params(list()), list())
x <- handle_params(list(hello = "world"), max_id = 1)
expect_equal(x$hello, "world")
expect_equal(x$max_id, 1)
x <- handle_params(list(hello = "world"), max_id = 1, since_id = 2)
expect_equal(x$hello, "world")
expect_equal(x$max_id, 1)
expect_equal(x$since_id, 2)
x <- handle_params(list(hello = "world"), max_id = 1, min_id = 3)
expect_equal(x$hello, "world")
expect_equal(x$max_id, 1)
expect_equal(x$min_id, 3)
expect_null(x$since_id)
## positional
x <- handle_params(list(hello = "world"), 1, 2)
expect_equal(x$hello, "world")
expect_equal(x$max_id, 1)
expect_equal(x$since_id, 2)
expect_null(x$min_id)
x <- handle_params(list(hello = "world"), 1, 2, 3)
expect_equal(x$hello, "world")
expect_equal(x$max_id, 1)
expect_equal(x$since_id, 2)
expect_equal(x$min_id, 3)
})

0 comments on commit 3b93671

Please sign in to comment.