Skip to content

Commit

Permalink
[R] add for more tests for URL validation (#13572)
Browse files Browse the repository at this point in the history
* add url validation in r client

* update samples

* add more tests for url validation
  • Loading branch information
wing328 authored Oct 3, 2022
1 parent c939894 commit 3ec6cc5
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -599,4 +599,14 @@ test_that("Tests URL validation", {
invalid_json <- '{"className":"date","percent_description":"abc","url_property":"invalid_url"}'
expect_error(Date$public_methods$validateJSON(invalid_json), 'Error! Invalid URL: invalid_url') # should throw exception

# test fromJSONString with valid data
d <- Date$new()
d$fromJSONString(valid_json)
expect_equal(d$className, "date")
expect_equal(d$percent_description, "abc")
expect_equal(d$url_property, "https://abc.com/a/1/b/2")

# test fromJSONString with invalid data
d <- Date$new()
expect_error(d$fromJSONString(invalid_json), 'Error! Invalid URL: invalid_url') # should throw exception
})

0 comments on commit 3ec6cc5

Please sign in to comment.