tests/testthat/test-htmlwidgets.R

context("Creating objects with DiagrammeR, mermaid, and grViz")

test_that("htmlwidgets object can be created", {

  diagrammer_htmlwidget <-
    DiagrammeR("
  graph LR
    A-->B
    A-->C
    C-->E
    B-->D
    C-->D
    D-->F
    E-->F")

  # Expect that the object inherits
  # from `DiagrammeR` and `htmlwidget`
  expect_is(
    diagrammer_htmlwidget, c("DiagrammeR", "htmlwidget"))

  mermaid_htmlwidget <-
    mermaid("
  graph LR
    A-->B
    A-->C
    C-->E
    B-->D
    C-->D
    D-->F
    E-->F")

  # Expect that the object inherits
  # from `DiagrammeR` and `htmlwidget`
  expect_is(
    mermaid_htmlwidget, c("DiagrammeR", "htmlwidget"))
})

Try the DiagrammeR package in your browser

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

DiagrammeR documentation built on May 31, 2023, 6:14 p.m.