From 0c051817a569c4997be97e345c95fd1b22434996 Mon Sep 17 00:00:00 2001 From: "Alec L. Robitaille" Date: Fri, 1 Nov 2024 11:20:16 -0300 Subject: [PATCH] test zzz columns are not in result --- tests/testthat/test-direction-to-leader.R | 8 ++++++++ tests/testthat/test-distance-to-leader.R | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/testthat/test-direction-to-leader.R b/tests/testthat/test-direction-to-leader.R index d44c9f99..9dced628 100644 --- a/tests/testthat/test-direction-to-leader.R +++ b/tests/testthat/test-direction-to-leader.R @@ -93,6 +93,14 @@ test_that('column added to the result DT is a double', { ) }) +test_that('zzz columns not added to the result', { + zzz_cols <- c('has_leader', 'zzz_leader_xcol', 'zzz_leader_ycol') + + expect_false( + any(zzz_cols %in% colnames(direction_to_leader(DT, coords = coords))) + ) +}) + test_that('returns a data.table', { expect_s3_class(direction_to_leader(DT, coords = coords, group = group), 'data.table') diff --git a/tests/testthat/test-distance-to-leader.R b/tests/testthat/test-distance-to-leader.R index f00c24fa..844b8b29 100644 --- a/tests/testthat/test-distance-to-leader.R +++ b/tests/testthat/test-distance-to-leader.R @@ -94,6 +94,14 @@ test_that('column added to the result DT is a double', { ) }) +test_that('zzz columns not added to the result', { + zzz_cols <- c('has_leader', 'zzz_N_by_group') + + expect_false( + any(zzz_cols %in% colnames(direction_to_leader(DT, coords = coords))) + ) +}) + test_that('returns a data.table', { expect_s3_class(distance_to_leader(DT, coords = coords, group = group), 'data.table')