tests/testthat/test-websocket.R

test_that("Websocket", {
  expect_error(WebsocketHandler$new())
  ws <- WebsocketHandler$new("hello", function(msg) {
    return(msg)
  })
  msg <- ws$receive(list(message = "world"))
  expect_equal(msg, "world")
  expect_snapshot(ws)

  ws <- Websocket$new(list())
  expect_snapshot(ws)
})

Try the ambiorix package in your browser

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

ambiorix documentation built on April 3, 2025, 9:34 p.m.