From bc706f19d05dcdf98f10af4460b4edca03908379 Mon Sep 17 00:00:00 2001 From: Schiano-NOAA Date: Mon, 24 Feb 2025 17:29:51 -0500 Subject: [PATCH] replace mention of satf with stockplotr in tests --- tests/testthat/test-exp_all_figs_tables.R | 8 ++++---- tests/testthat/test-export_rda.R | 8 ++++---- tests/testthat/test-extract_caps_alttext.R | 8 ++++---- tests/testthat/test-plot_biomass.R | 20 +++++++++---------- tests/testthat/test-plot_landings.R | 8 ++++---- tests/testthat/test-plot_recruitment.R | 12 +++++------ .../test-plot_recruitment_deviations.R | 10 +++++----- tests/testthat/test-plot_spawn_recruitment.R | 10 +++++----- tests/testthat/test-plot_spawning_biomass.R | 20 +++++++++---------- tests/testthat/test-table_bnc.R | 10 +++++----- tests/testthat/test-table_indices.R | 10 +++++----- tests/testthat/test-write_captions.R | 4 ++-- 12 files changed, 64 insertions(+), 64 deletions(-) diff --git a/tests/testthat/test-exp_all_figs_tables.R b/tests/testthat/test-exp_all_figs_tables.R index 52ebedb..b813628 100644 --- a/tests/testthat/test-exp_all_figs_tables.R +++ b/tests/testthat/test-exp_all_figs_tables.R @@ -2,10 +2,10 @@ test_that("exp_all_figs_tables works when all figures/tables are plotted", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) - satf::exp_all_figs_tables( dat, + stockplotr::exp_all_figs_tables( dat, end_year = 2022, ref_line = "unfished", ref_line_sb = "target", @@ -38,11 +38,11 @@ test_that("exp_all_figs_tables works when some figures/tables are not plotted", # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # plot all figs/tables except for plot_biomass - satf::exp_all_figs_tables( dat, + stockplotr::exp_all_figs_tables( dat, end_year = 2022, # add an unreal ref_line so plot_biomass doesn't work ref_line = "not_a_real_ref_line", diff --git a/tests/testthat/test-export_rda.R b/tests/testthat/test-export_rda.R index 8eb9f5e..37630f7 100644 --- a/tests/testthat/test-export_rda.R +++ b/tests/testthat/test-export_rda.R @@ -5,7 +5,7 @@ test_that("export_rda works for figures", { "resources", "sample_data", "petrale_sole-after_2020.csv", - package = "satf" + package = "stockplotr" ) ) @@ -13,7 +13,7 @@ test_that("export_rda works for figures", { fig_or_table <- "figure" # run write_captions.R - satf::write_captions(dat = dat, + stockplotr::write_captions(dat = dat, dir = getwd(), year = 2022) @@ -55,7 +55,7 @@ test_that("export_rda works for tables", { "resources", "sample_data", "petrale_sole-after_2020.csv", - package = "satf" + package = "stockplotr" ) ) @@ -63,7 +63,7 @@ test_that("export_rda works for tables", { fig_or_table <- "table" # run write_captions.R - satf::write_captions(dat = dat, + stockplotr::write_captions(dat = dat, dir = getwd(), year = 2022) diff --git a/tests/testthat/test-extract_caps_alttext.R b/tests/testthat/test-extract_caps_alttext.R index 44bf783..045c0b7 100644 --- a/tests/testthat/test-extract_caps_alttext.R +++ b/tests/testthat/test-extract_caps_alttext.R @@ -2,14 +2,14 @@ test_that("extract_caps_alttext works for figures", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) topic_label <- "biomass" fig_or_table <- "figure" # run write_captions.R - satf::write_captions(dat = dat, + stockplotr::write_captions(dat = dat, dir = getwd(), year = 2022) @@ -37,14 +37,14 @@ test_that("extract_caps_alttext works for tables", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) topic_label <- "bnc" fig_or_table <- "table" # run write_captions.R - satf::write_captions(dat = dat, + stockplotr::write_captions(dat = dat, dir = getwd(), year = 2022) diff --git a/tests/testthat/test-plot_biomass.R b/tests/testthat/test-plot_biomass.R index ead2510..cc2a419 100644 --- a/tests/testthat/test-plot_biomass.R +++ b/tests/testthat/test-plot_biomass.R @@ -2,22 +2,22 @@ test_that("plot_biomass generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::plot_biomass(dat) + stockplotr::plot_biomass(dat) ) # expect plot with warnings if ref_point not indicated expect_warning( - satf::plot_biomass(dat) + stockplotr::plot_biomass(dat) ) # expect error-free plot with many arguments expect_no_error( - satf::plot_biomass( + stockplotr::plot_biomass( dat, ref_point = 18000, unit_label = "metric tons", @@ -31,7 +31,7 @@ test_that("plot_biomass generates plots without errors", { # expect error-free plot when setting relative to T expect_no_error( - satf::plot_biomass( + stockplotr::plot_biomass( dat, ref_point = 18000, unit_label = "metric tons", @@ -45,7 +45,7 @@ test_that("plot_biomass generates plots without errors", { # expect ggplot object is returned expect_s3_class( - satf::plot_biomass( + stockplotr::plot_biomass( dat, ref_point = 18000, unit_label = "metric tons", @@ -64,7 +64,7 @@ test_that("plot_biomass plots contain reference point when indicated", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) @@ -72,14 +72,14 @@ test_that("plot_biomass plots contain reference point when indicated", { # plot w/o ref pt contains only 3 layers # make b plot with reference point - b_ref <- satf::plot_biomass(dat, + b_ref <- stockplotr::plot_biomass(dat, ref_point = 18000) # extract number of layers (should be 4) b_ref_layers <- b_ref[["layers"]] |> length() # make b plot without reference point - b_no_ref <- satf::plot_biomass(dat) + b_no_ref <- stockplotr::plot_biomass(dat) # extract number of layers (should be 3) b_no_ref_layers <- b_no_ref[["layers"]] |> length() @@ -94,7 +94,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-plot_landings.R b/tests/testthat/test-plot_landings.R index 4695131..0c54ee2 100644 --- a/tests/testthat/test-plot_landings.R +++ b/tests/testthat/test-plot_landings.R @@ -2,18 +2,18 @@ test_that("plot_landings generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::plot_landings(dat) + stockplotr::plot_landings(dat) ) # expect ggplot object is returned expect_s3_class( - satf::plot_landings(dat) + stockplotr::plot_landings(dat) , "gg" ) @@ -24,7 +24,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-plot_recruitment.R b/tests/testthat/test-plot_recruitment.R index d5d2b4d..29bee98 100644 --- a/tests/testthat/test-plot_recruitment.R +++ b/tests/testthat/test-plot_recruitment.R @@ -2,18 +2,18 @@ test_that("plot_recruitment generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::plot_recruitment(dat, + stockplotr::plot_recruitment(dat, end_year = 2022) ) # expect error-free plot with many arguments expect_no_error( - satf::plot_recruitment( + stockplotr::plot_recruitment( dat, unit_label = "mt", scale_amount = 10, @@ -27,7 +27,7 @@ test_that("plot_recruitment generates plots without errors", { # expect error-free plot when setting relative to T expect_no_error( - satf::plot_recruitment( + stockplotr::plot_recruitment( dat, unit_label = "mt", scale_amount = 10, @@ -41,7 +41,7 @@ test_that("plot_recruitment generates plots without errors", { # expect ggplot object is returned expect_s3_class( - satf::plot_recruitment( + stockplotr::plot_recruitment( dat, unit_label = "mt", scale_amount = 10, @@ -60,7 +60,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-plot_recruitment_deviations.R b/tests/testthat/test-plot_recruitment_deviations.R index a1c9cdc..54632e1 100644 --- a/tests/testthat/test-plot_recruitment_deviations.R +++ b/tests/testthat/test-plot_recruitment_deviations.R @@ -2,18 +2,18 @@ test_that("plot_recruitment_deviations generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::plot_recruitment_deviations(dat, + stockplotr::plot_recruitment_deviations(dat, end_year = 2022) ) # expect error-free plot with many arguments expect_no_error( - satf::plot_recruitment_deviations( + stockplotr::plot_recruitment_deviations( dat, end_year = 2022, n_projected_years = 5, @@ -24,7 +24,7 @@ test_that("plot_recruitment_deviations generates plots without errors", { # expect ggplot object is returned expect_s3_class( - satf::plot_recruitment_deviations( + stockplotr::plot_recruitment_deviations( dat, end_year = 2022, n_projected_years = 5, @@ -40,7 +40,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-plot_spawn_recruitment.R b/tests/testthat/test-plot_spawn_recruitment.R index 7504df1..ef2b40b 100644 --- a/tests/testthat/test-plot_spawn_recruitment.R +++ b/tests/testthat/test-plot_spawn_recruitment.R @@ -2,17 +2,17 @@ test_that("plot_spawn_recruitment generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::plot_spawn_recruitment(dat) + stockplotr::plot_spawn_recruitment(dat) ) # expect error-free plot with many arguments expect_no_error( - satf::plot_spawn_recruitment( + stockplotr::plot_spawn_recruitment( dat, spawning_biomass_label = "mt", recruitment_label = "mt", @@ -25,7 +25,7 @@ test_that("plot_spawn_recruitment generates plots without errors", { # expect ggplot object is returned expect_s3_class( - satf::plot_spawn_recruitment( + stockplotr::plot_spawn_recruitment( dat, spawning_biomass_label = "mt", recruitment_label = "mt", @@ -42,7 +42,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-plot_spawning_biomass.R b/tests/testthat/test-plot_spawning_biomass.R index 9b8ed30..b7fa875 100644 --- a/tests/testthat/test-plot_spawning_biomass.R +++ b/tests/testthat/test-plot_spawning_biomass.R @@ -2,22 +2,22 @@ test_that("plot_spawning_biomass generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::plot_spawning_biomass(dat) + stockplotr::plot_spawning_biomass(dat) ) # expect plot with warnings if ref_point not indicated expect_warning( - satf::plot_spawning_biomass(dat) + stockplotr::plot_spawning_biomass(dat) ) # expect error-free plot with many arguments expect_no_error( - satf::plot_spawning_biomass( + stockplotr::plot_spawning_biomass( dat, unit_label = "metric tons", scale_amount = 1, @@ -28,7 +28,7 @@ test_that("plot_spawning_biomass generates plots without errors", { # expect error-free plot when setting relative to T expect_no_error( - satf::plot_spawning_biomass( + stockplotr::plot_spawning_biomass( dat, unit_label = "metric tons", scale_amount = 1, @@ -40,7 +40,7 @@ test_that("plot_spawning_biomass generates plots without errors", { # expect ggplot object is returned expect_s3_class( - satf::plot_spawning_biomass( + stockplotr::plot_spawning_biomass( dat, unit_label = "metric tons", scale_amount = 1, @@ -57,7 +57,7 @@ test_that("plot_spawning_biomass plots contain reference point when indicated", # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) @@ -65,14 +65,14 @@ test_that("plot_spawning_biomass plots contain reference point when indicated", # plot w/o ref pt contains only 3 layers # make sb plot with reference point - sb_ref <- satf::plot_spawning_biomass(dat, + sb_ref <- stockplotr::plot_spawning_biomass(dat, ref_point = 18000) # extract number of layers (should be 4) sb_ref_layers <- sb_ref[["layers"]] |> length() # make sb plot without reference point - sb_no_ref <- satf::plot_spawning_biomass(dat) + sb_no_ref <- stockplotr::plot_spawning_biomass(dat) # extract number of layers (should be 3) sb_no_ref_layers <- sb_no_ref[["layers"]] |> length() @@ -87,7 +87,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-table_bnc.R b/tests/testthat/test-table_bnc.R index cc4e4f0..f2673cf 100644 --- a/tests/testthat/test-table_bnc.R +++ b/tests/testthat/test-table_bnc.R @@ -2,18 +2,18 @@ test_that("table_bnc generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::table_bnc(dat, + stockplotr::table_bnc(dat, end_year = 2022) ) # expect error-free plot with many arguments expect_no_error( - satf::table_bnc( + stockplotr::table_bnc( dat, end_year = 2025, biomass_unit_label = "mt", @@ -26,7 +26,7 @@ test_that("table_bnc generates plots without errors", { # expect flextable object is returned expect_s3_class( - satf::table_bnc( + stockplotr::table_bnc( dat, end_year = 2025, biomass_unit_label = "mt", @@ -43,7 +43,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-table_indices.R b/tests/testthat/test-table_indices.R index 8533ecc..9e2dc2c 100644 --- a/tests/testthat/test-table_indices.R +++ b/tests/testthat/test-table_indices.R @@ -2,17 +2,17 @@ test_that("table_indices generates plots without errors", { # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # expect error-free plot with minimal arguments expect_no_error( - satf::table_indices(dat) + stockplotr::table_indices(dat) ) # expect error-free plot with many arguments expect_no_error( - satf::table_indices( + stockplotr::table_indices( dat, make_rda = FALSE, rda_dir = getwd() @@ -22,7 +22,7 @@ test_that("table_indices generates plots without errors", { # expect flextable object is returned expect_s3_class( - satf::table_indices( + stockplotr::table_indices( dat, make_rda = FALSE, rda_dir = getwd() @@ -36,7 +36,7 @@ test_that("rda file made when indicated",{ # read in sample dataset dat <- utils::read.csv( - system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "satf") + system.file("resources", "sample_data", "petrale_sole-after_2020.csv", package = "stockplotr") ) # export rda diff --git a/tests/testthat/test-write_captions.R b/tests/testthat/test-write_captions.R index 8626e75..ba4f4e0 100644 --- a/tests/testthat/test-write_captions.R +++ b/tests/testthat/test-write_captions.R @@ -2,7 +2,7 @@ test_that("write_captions() function imports alt text/captions template as a data frame", { # import pre-written captions and alt text template - caps_alttext <- utils::read.csv(system.file("resources", "captions_alt_text_template.csv", package = "satf")) + caps_alttext <- utils::read.csv(system.file("resources", "captions_alt_text_template.csv", package = "stockplotr")) expect_s3_class(caps_alttext, "data.frame") @@ -18,7 +18,7 @@ test_that("write_captions() function replaces placeholder text with key quantiti "resources", "sample_data", "petrale_sole-after_2020.csv", - package = "satf" + package = "stockplotr" ) )