Skip to content

Commit

Permalink
replace mention of satf with stockplotr in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Schiano-NOAA committed Feb 24, 2025
1 parent 174a160 commit bc706f1
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 64 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test-exp_all_figs_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-export_rda.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ test_that("export_rda works for figures", {
"resources",
"sample_data",
"petrale_sole-after_2020.csv",
package = "satf"
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)

Expand Down Expand Up @@ -55,15 +55,15 @@ test_that("export_rda works for tables", {
"resources",
"sample_data",
"petrale_sole-after_2020.csv",
package = "satf"
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)

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-extract_caps_alttext.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
20 changes: 10 additions & 10 deletions tests/testthat/test-plot_biomass.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -64,22 +64,22 @@ 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")
)


# expect plot with a reference point (horizontal line) contains 4 layers while
# 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()
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-plot_landings.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-plot_recruitment.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-plot_recruitment_deviations.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/testthat/test-plot_spawn_recruitment.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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
Expand Down
Loading

0 comments on commit bc706f1

Please sign in to comment.