Skip to content

Commit

Permalink
Merge pull request #63 from jennalenoble/add-source-to-tests
Browse files Browse the repository at this point in the history
added sources to test files
  • Loading branch information
jennalenoble authored Mar 12, 2023
2 parents fc8d9ba + b91c17c commit d40f854
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
7 changes: 2 additions & 5 deletions tests/bar_plot_tests.R
Original file line number Diff line number Diff line change
@@ -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", {
Expand Down
4 changes: 4 additions & 0 deletions tests/bar_plot_tests_helper.R
Original file line number Diff line number Diff line change
@@ -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")
1 change: 1 addition & 0 deletions tests/hist_plot_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
1 change: 1 addition & 0 deletions tests/scatter_plot_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
3 changes: 2 additions & 1 deletion tests/test-summarize_column.R
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit d40f854

Please sign in to comment.