Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/table_index.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ table_index <- function(
}

create_rda(
object = final[[1]],
object = final,
# get name of function and remove "table_" from it
topic_label = gsub("table_", "", utils::tail(as.character(sys.call()[[1]]), n = 1)),
fig_or_table = "table",
Expand Down
2 changes: 1 addition & 1 deletion R/table_landings.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ table_landings <- function(
insert_kqs(landings.units, dir = tables_dir)

create_rda(
object = final[[1]],
object = final,
# get name of function and remove "table_" from it
topic_label = gsub("table_", "", utils::tail(as.character(sys.call()[[1]]), n = 1)),
fig_or_table = "table",
Expand Down
28 changes: 0 additions & 28 deletions tests/testthat/test-table_index.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,3 @@ test_that("table_index generates plots without errors", {
# "gt_tbl"
# )
})

# test_that("rda file made when indicated", {
# # export rda
# table_index(
# dat = stockplotr::example_data,
# interactive = FALSE,
# make_rda = TRUE,
# tables_dir = getwd()
# )

# # load the rda file and check that it contains the expected object
# load(fs::path(getwd(), "tables", "index_table.rda"))
# # expect rda contains three objects: table, caption, and latex table
# expect_false(
# is.null(rda$table)
# )
# expect_false(
# is.null(rda$caption)
# )
# expect_false(
# is.null(rda$latex_table)
# )

# expect_true(rda$caption == "Calculated index of abundance and corresponding CVs for the fleets and surveys identified in the column headers. ")

# # erase temporary testing files
# check_and_remove_tmp_files("index_table.rda", figs_or_tables="tables")
# })
53 changes: 1 addition & 52 deletions tests/testthat/test-table_landings.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,6 @@ test_that("table_landings generates plots without errors", {
# )
})

# test_that("rda file made when indicated", {
# # export rda
# table_landings(
# dat = stockplotr::example_data,
# unit_label = "mt",
# era = NULL,
# interactive = FALSE,
# module = "CATCH",
# make_rda = TRUE,
# tables_dir = getwd()
# )

# # expect that both tables dir and the landings_table.rda file exist
# expect_true(dir.exists(fs::path(getwd(), "tables")))
# expect_true(file.exists(fs::path(getwd(), "tables", "landings_table.rda")))

# # erase temporary testing files
# file.remove(fs::path(getwd(), "captions_alt_text.csv"))
# file.remove(fs::path(getwd(), "key_quantities.csv"))
# unlink(fs::path(getwd(), "tables"), recursive = T)
# })

test_that("table_landings generates error with incorrect module", {
# expect error
# Need to test this -- not exactly the right test/result
Expand All @@ -73,33 +51,4 @@ test_that("table_landings generates error with incorrect module", {
tables_dir = getwd()
)
)
})


# test_that("rda file made when indicated", {
# # export rda
# table_landings(
# dat = stockplotr::example_data,
# interactive = FALSE,
# make_rda = TRUE,
# tables_dir = getwd()
# )

# # load the rda file and check that it contains the expected object
# load(fs::path(getwd(), "tables", "landings_table.rda"))
# # expect rda contains three objects: table, caption, and latex table
# expect_false(
# is.null(rda$table)
# )
# expect_false(
# is.null(rda$caption)
# )
# expect_false(
# is.null(rda$latex_table)
# )

# expect_true(rda$caption == "Landed catch by fleet and year in (mt).")

# # erase temporary testing files
# check_and_remove_tmp_files("landings_table.rda", figs_or_tables="tables")
# })
})
Loading