tests/testthat/test-label.R

test_that("Correct node labels created", {
  # Load rivnet
  net <- readRDS(test_path("testdata", "testnet.rds"))

  # Run test
  net_label <- suppressWarnings(node_labeling(net))
  labels <- net_label %>%
    sfnetworks::activate(nodes) %>%
    dplyr::pull(node_label)
  expect_snapshot(labels)
})

test_that("Correct member labels created", {
  # Load rivnet
  net <- readRDS(test_path("testdata", "testnet.rds"))

  # Run test
  net_label <- suppressWarnings(membership_labeling(net))
  labels <- net_label %>%
    sfnetworks::activate(nodes) %>%
    dplyr::pull(member_label)
  expect_snapshot(labels)
})

Try the dci package in your browser

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

dci documentation built on June 14, 2025, 1:08 a.m.