Skip to content

Commit

Permalink
test: serialiser #48
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoene committed Mar 26, 2022
1 parent 82b5cf5 commit 7f15a1c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 1 addition & 6 deletions R/ambiorix.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ Ambiorix <- R6::R6Class(
#' if(interactive())
#' app$start()
serialiser = function(handler){
assert_that(is_function(handler))
options(AMBIORIX_SERIALISER = handler)
invisible(self)
},
Expand Down Expand Up @@ -238,12 +239,6 @@ Ambiorix <- R6::R6Class(
}
),
active = list(
websocket = function(value){
if(missing(value))
stop("This is a setter only")

private$.wss <- value
},
port = function(value) {
if(missing(value))
return(private$.port)
Expand Down
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ check: document

document:
Rscript -e "devtools::document()"

test:
Rscript -e "devtools::test()"
2 changes: 2 additions & 0 deletions man/Ambiorix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/testthat/test-basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ test_that("Ambiorix", {
expect_s3_class(app$set_404(\(req, res) {
res$send("Errr")
}), "Ambiorix")

expect_error(app$serialiser("error"))
expect_s3_class(app$serialiser(\(data) {
return("data")
}), "Ambiorix")

})

0 comments on commit 7f15a1c

Please sign in to comment.