test_that("treeplot returns a ggplot object for longitree", { data(ltreedata) result <- longitree(y ~ ., time = "time", random = "subject", weight = 0.2, data = ltreedata, gamma = 1.5) p <- treeplot(result) expect_s3_class(p, "ggplot") }) test_that("treeplot errors on invalid input", { expect_error(treeplot("not_a_tree"), "longitree or threetrees") })