tests/testthat/test-cluster.R

library(testthat)

context("Cluster")

test_that("clusters", {
  
  nodes <- sg_make_nodes() 
  edges <- sg_make_edges(nodes)
  
  sg <- sigmajs() %>% 
    sg_nodes(nodes, id, size) %>% 
    sg_edges(edges, id, source, target) %>% 
    sg_layout() %>% 
    sg_cluster(quiet = FALSE)
  
  expect_error(sg_nodes(nodes, id, size))
  expect_error(sg_edges(nodes, id, size))
  
  clustered <- sg_get_cluster(nodes, edges)
  
  expect_error(sg_get_cluster())
  
  expect_s3_class(clustered, "data.frame")
})

Try the sigmajs package in your browser

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

sigmajs documentation built on July 8, 2020, 5:16 p.m.