From b91c17c59911eb20e8faf100ba473971f9641d42 Mon Sep 17 00:00:00 2001 From: Jenna Le Noble Date: Sun, 12 Mar 2023 14:47:21 -0700 Subject: [PATCH] added sources to test files --- tests/bar_plot_tests.R | 7 ++----- tests/bar_plot_tests_helper.R | 4 ++++ tests/hist_plot_tests.R | 1 + tests/scatter_plot_tests.R | 1 + tests/test-summarize_column.R | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 tests/bar_plot_tests_helper.R diff --git a/tests/bar_plot_tests.R b/tests/bar_plot_tests.R index 02f495d..4f12f93 100644 --- a/tests/bar_plot_tests.R +++ b/tests/bar_plot_tests.R @@ -1,10 +1,7 @@ library(testthat) -source("../../R/bar_plot.R") - -#helper function -bar_iris <- bar_graph(iris, iris$Species, iris$Sepal.Width, "Species", "Sepal Width", "Species", "Iris Graph") - +source("./R/bar_plot.R") +source("./tests/bar_plot_tests_helper.R") #test for input variables test_that("Function can only accept certain data types for arguments", { diff --git a/tests/bar_plot_tests_helper.R b/tests/bar_plot_tests_helper.R new file mode 100644 index 0000000..2652481 --- /dev/null +++ b/tests/bar_plot_tests_helper.R @@ -0,0 +1,4 @@ +#helper function + +source("./R/bar_plot.R") +bar_iris <- bar_graph(iris, iris$Species, iris$Sepal.Width, "Species", "Sepal Width", "Species", "Iris Graph") diff --git a/tests/hist_plot_tests.R b/tests/hist_plot_tests.R index 6c0788d..aee824d 100644 --- a/tests/hist_plot_tests.R +++ b/tests/hist_plot_tests.R @@ -2,6 +2,7 @@ library(testthat) library(ggcheck) source("./R/hist_plot.R") +source("./tests/hist_plot_tests_helper.R") #test for input variables test_that("Function can only accept certain data types for arguments", { diff --git a/tests/scatter_plot_tests.R b/tests/scatter_plot_tests.R index 9b39d5c..2b53e26 100644 --- a/tests/scatter_plot_tests.R +++ b/tests/scatter_plot_tests.R @@ -3,6 +3,7 @@ library(ggcheck) library(testthat) source("./R/scatter_plot.R") +source("./tests/scatter_plot_tests_helper.R") #test for input variables test_that("Function can only accept certain data types for arguments", { diff --git a/tests/test-summarize_column.R b/tests/test-summarize_column.R index 70a2e47..9ed212f 100644 --- a/tests/test-summarize_column.R +++ b/tests/test-summarize_column.R @@ -1,7 +1,8 @@ library(testthat) library("dplyr") -source("~/dsci-310-group-09/R/summarize_column.R") +source("./R/summarize_column.R") +source("./tests/helper-summarize_column.R") test_that("summarize_column function returns a df or df extension", { expect_s3_class(summarize_column(mtcars, mpg), "data.frame")