tests/testthat/test-tipmap_plot.R

test_that("mapping correct", {
  plot <- tipmap_plot(load_tipmap_data("tipdat.rds"))
  expect_equal(as.character(plot$layers[[1]]$mapping), c("~yintercept"))
  expect_equal(as.character(plot$layers[[3]]$mapping), c("~t.0.025", "~t.0.975"))
  expect_equal(as.character(plot$layers[[4]]$mapping), c("~t.est"))
  expect_equal(as.character(plot$layers[[5]]$mapping), c("~t.0.025", "2.5%/97.5%", "2.5%/97.5%"))
  expect_equal(as.character(plot$layers[[6]]$mapping), c("~t.0.05", "5%/95%", "5%/95%"))
  expect_equal(as.character(plot$layers[[7]]$mapping), c("~t.0.1", "10%/90%", "10%/90%"))
  expect_equal(as.character(plot$layers[[8]]$mapping), c("~t.0.2", "20%/80%", "20%/80%"))
  expect_equal(as.character(plot$layers[[9]]$mapping), c("~t.0.8", "20%/80%", "20%/80%"))
  expect_equal(as.character(plot$layers[[10]]$mapping), c("~t.0.9", "10%/90%", "10%/90%"))
  expect_equal(as.character(plot$layers[[11]]$mapping), c("~t.0.95", "5%/95%", "5%/95%"))
  expect_equal(as.character(plot$layers[[12]]$mapping), c("~t.0.975", "2.5%/97.5%", "2.5%/97.5%"))
  expect_equal(as.character(plot$layers[[14]]$mapping), c("~tippingPoint.025"))
  expect_equal(as.character(plot$layers[[16]]$mapping), c("~tippingPoint.05"))
  expect_equal(as.character(plot$layers[[18]]$mapping), c("~tippingPoint.1"))
  expect_equal(as.character(plot$layers[[20]]$mapping), c("~tippingPoint.2"))
})

Try the tipmap package in your browser

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

tipmap documentation built on Dec. 8, 2022, 1:13 a.m.