Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Oct 6, 2024
1 parent b3e362b commit 37b5e67
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/testthat/test-StubbedRequest.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ context("StubbedRequest")
test_that("StubbedRequest: works", {
expect_is(StubbedRequest, "R6ClassGenerator")

aa <- StubbedRequest$new(method = "get", uri = "https:/hb.opencpu.org/get")
aa <- StubbedRequest$new(method = "get", uri = "https://hb.opencpu.org/get")

expect_is(aa, "StubbedRequest")

Expand All @@ -19,27 +19,27 @@ test_that("StubbedRequest: works", {
expect_equal(aa$method, "get")

expect_is(aa$uri, "character")
expect_equal(aa$uri, "https:/hb.opencpu.org/get")
expect_equal(aa$uri, "https://hb.opencpu.org/get")

expect_is(aa$uri_parts, "list")
expect_equal(aa$uri_parts$domain, "https")
expect_equal(aa$uri_parts$path, "hb.opencpu.org/get")
expect_equal(aa$uri_parts$domain, "hb.opencpu.org")
expect_equal(aa$uri_parts$path, "get")

expect_is(aa$to_s, "function")
expect_equal(aa$to_s(), "GET: https:/hb.opencpu.org/get")
expect_equal(aa$to_s(), "GET: https://hb.opencpu.org/get")

# with
expect_is(aa$with, "function")
expect_null(aa$query)
aa$with(query = list(foo = "bar"))
expect_is(aa$query, "list")
expect_named(aa$query, "foo")
expect_equal(aa$to_s(), "GET: https:/hb.opencpu.org/get?foo=bar")
expect_equal(aa$to_s(), "GET: https://hb.opencpu.org/get with query params foo=bar")

## >1 query param gets combined with "&" and not ","
aa$with(query = list(foo = "bar", stuff = 567))
expect_equal(sort(names(aa$query)), c("foo", "stuff"))
expect_equal(aa$to_s(), "GET: https:/hb.opencpu.org/get?foo=bar&stuff=567")
expect_equal(aa$to_s(), "GET: https://hb.opencpu.org/get with query params foo=bar, stuff=567")

# to_return
expect_is(aa$to_return, "function")
Expand Down

0 comments on commit 37b5e67

Please sign in to comment.