From 18217bfe9185cf48861a8af589745b0587e763c3 Mon Sep 17 00:00:00 2001 From: Sebastian Gibb Date: Sun, 9 Jun 2024 19:29:42 +0200 Subject: [PATCH] fix: replace test_path with system.file --- tests/testthat/test_read_dltr.R | 10 +++++----- tests/testthat/test_read_logbook.R | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test_read_dltr.R b/tests/testthat/test_read_dltr.R index ed4dd77..41bfa67 100644 --- a/tests/testthat/test_read_dltr.R +++ b/tests/testthat/test_read_dltr.R @@ -4,7 +4,7 @@ test_that("read_dltr throws errors", { test_that("read_dltr returns a data.table", { expect_true( - is.data.table(read_dltr(test_path("..", "..", "inst", "logbook.txt"))) + is.data.table(read_dltr(system.file("logbook.txt", package = "dltr"))) ) }) @@ -17,11 +17,11 @@ test_that("is_trends_file throws errors", { }) test_that("is_logbook_file works", { - expect_true(is_logbook_file(test_path("..", "..", "inst", "logbook.txt"))) - expect_false(is_logbook_file(test_path("..", "..", "inst", "trends.txt"))) + expect_true(is_logbook_file(system.file("logbook.txt", package = "dltr"))) + expect_false(is_logbook_file(system.file("trends.txt", package = "dltr"))) }) test_that("is_trends_file works", { - expect_true(is_trends_file(test_path("..", "..", "inst", "trends.txt"))) - expect_false(is_trends_file(test_path("..", "..", "inst", "logbook.txt"))) + expect_true(is_trends_file(system.file("trends.txt", package = "dltr"))) + expect_false(is_trends_file(system.file("logbook.txt", package = "dltr"))) }) diff --git a/tests/testthat/test_read_logbook.R b/tests/testthat/test_read_logbook.R index 6ccc155..fa7d3f7 100644 --- a/tests/testthat/test_read_logbook.R +++ b/tests/testthat/test_read_logbook.R @@ -3,7 +3,7 @@ test_that(".read_logbook throws errors", { }) test_that(".read_logbook", { - lb <- .read_logbook(test_path("..", "..", "inst", "logbook.txt")) + lb <- .read_logbook(system.file("logbook.txt", package = "dltr")) expect_true(is.data.table(lb))