@@ -27,117 +27,117 @@ test_that("Creates expected start of nearly empty tables doc", {
2727 file.remove(fs :: path(getwd(), " 08_tables.qmd" ))
2828})
2929
30- test_that(" Creates expected start of tables doc with table" , {
31- # load sample dataset
32- load(file.path(
33- " fixtures" , " ss3_models_converted" , " Hake_2018" ,
34- " std_output.rda"
35- ))
36-
37- stockplotr :: table_landings(out_new ,
38- make_rda = TRUE
39- )
40-
41- # create tables doc
42- create_tables_doc(
43- subdir = getwd(),
44- tables_dir = getwd()
45- )
46-
47- # read in tables doc
48- table_content <- readLines(" 08_tables.qmd" )
49- # extract first 7 lines
50- head_table_content <- head(table_content , 7 )
51- # remove line numbers and collapse
52- fc_pasted <- paste(head_table_content , collapse = " " )
53-
54- # expected tables doc head
55- expected_head_table_content <- " # Tables {#sec-tables} ```{r} #| label: 'set-rda-dir-tbls'#| echo: false #| warning: false #| include: false"
56-
57- # test expectation of start of tables doc
58- testthat :: expect_equal(
59- fc_pasted ,
60- expected_head_table_content
61- )
62-
63- # erase temporary testing files
64- file.remove(fs :: path(getwd(), " 08_tables.qmd" ))
65- file.remove(fs :: path(getwd(), " captions_alt_text.csv" ))
66- unlink(fs :: path(getwd(), " tables" ), recursive = T )
67- })
68-
69- test_that(" Throws warning if chunks with identical labels" , {
70- # load sample dataset
71- load(file.path(
72- " fixtures" , " ss3_models_converted" , " Hake_2018" ,
73- " std_output.rda"
74- ))
75-
76- stockplotr :: table_landings(out_new ,
77- make_rda = TRUE
78- )
79-
80- # create tables doc
81- create_tables_doc(
82- subdir = getwd(),
83- tables_dir = getwd()
84- )
85-
86- expect_message(
87- create_tables_doc(
88- subdir = getwd(),
89- tables_dir = getwd()
90- ),
91- " Tables doc will not render if chunks have identical labels."
92- )
93-
94- # erase temporary testing files
95- file.remove(fs :: path(getwd(), " 08_tables.qmd" ))
96- file.remove(fs :: path(getwd(), " captions_alt_text.csv" ))
97- unlink(fs :: path(getwd(), " tables" ), recursive = T )
98- })
99-
100- test_that(" Formerly empty tables doc renders correctly" , {
101- # create empty tables doc
102- create_template()
103-
104- # load sample dataset
105- load(file.path(
106- " fixtures" , " ss3_models_converted" , " Hake_2018" ,
107- " std_output.rda"
108- ))
109-
110- stockplotr :: table_landings(
111- dat = out_new ,
112- make_rda = TRUE ,
113- module = " CATCH"
114- )
115-
116- # rerender tables doc, appending new table
117- create_tables_doc(
118- subdir = file.path(getwd(), " report" ),
119- tables_dir = getwd()
120- )
121-
122- # read in tables doc
123- table_content <- readLines(file.path(getwd(), " report" , " 08_tables.qmd" ))
124- # extract first 8 lines
125- head_table_content <- head(table_content , 8 )
126- # remove line numbers and collapse
127- fc_pasted <- paste(head_table_content , collapse = " " )
128-
129- # expected tables doc head
130- expected_head_table_content <- " # Tables {#sec-tables} ```{r} #| label: 'set-rda-dir-tbls'#| echo: false #| warning: false #| include: false"
131-
132- # test expectation of start of tables doc
133- expect_equal(
134- fc_pasted ,
135- expected_head_table_content
136- )
137-
138- # erase temporary testing files
139- file.remove(fs :: path(getwd(), " 08_tables.qmd" ))
140- file.remove(fs :: path(getwd(), " captions_alt_text.csv" ))
141- unlink(fs :: path(getwd(), " tables" ), recursive = T )
142- unlink(fs :: path(getwd(), " report" ), recursive = T )
143- })
30+ # test_that("Creates expected start of tables doc with table", {
31+ # # load sample dataset
32+ # load(file.path(
33+ # "fixtures", "ss3_models_converted", "Hake_2018",
34+ # "std_output.rda"
35+ # ))
36+ #
37+ # stockplotr::table_landings(out_new,
38+ # make_rda = TRUE
39+ # )
40+ #
41+ # # create tables doc
42+ # create_tables_doc(
43+ # subdir = getwd(),
44+ # tables_dir = getwd()
45+ # )
46+ #
47+ # # read in tables doc
48+ # table_content <- readLines("08_tables.qmd")
49+ # # extract first 7 lines
50+ # head_table_content <- head(table_content, 7)
51+ # # remove line numbers and collapse
52+ # fc_pasted <- paste(head_table_content, collapse = "")
53+ #
54+ # # expected tables doc head
55+ # expected_head_table_content <- "# Tables {#sec-tables} ```{r} #| label: 'set-rda-dir-tbls'#| echo: false #| warning: false #| include: false"
56+ #
57+ # # test expectation of start of tables doc
58+ # testthat::expect_equal(
59+ # fc_pasted,
60+ # expected_head_table_content
61+ # )
62+ #
63+ # # erase temporary testing files
64+ # file.remove(fs::path(getwd(), "08_tables.qmd"))
65+ # file.remove(fs::path(getwd(), "captions_alt_text.csv"))
66+ # unlink(fs::path(getwd(), "tables"), recursive = T)
67+ # })
68+ #
69+ # test_that("Throws warning if chunks with identical labels", {
70+ # # load sample dataset
71+ # load(file.path(
72+ # "fixtures", "ss3_models_converted", "Hake_2018",
73+ # "std_output.rda"
74+ # ))
75+ #
76+ # stockplotr::table_landings(out_new,
77+ # make_rda = TRUE
78+ # )
79+ #
80+ # # create tables doc
81+ # create_tables_doc(
82+ # subdir = getwd(),
83+ # tables_dir = getwd()
84+ # )
85+ #
86+ # expect_message(
87+ # create_tables_doc(
88+ # subdir = getwd(),
89+ # tables_dir = getwd()
90+ # ),
91+ # "Tables doc will not render if chunks have identical labels."
92+ # )
93+ #
94+ # # erase temporary testing files
95+ # file.remove(fs::path(getwd(), "08_tables.qmd"))
96+ # file.remove(fs::path(getwd(), "captions_alt_text.csv"))
97+ # unlink(fs::path(getwd(), "tables"), recursive = T)
98+ # })
99+ #
100+ # test_that("Formerly empty tables doc renders correctly", {
101+ # # create empty tables doc
102+ # create_template()
103+ #
104+ # # load sample dataset
105+ # load(file.path(
106+ # "fixtures", "ss3_models_converted", "Hake_2018",
107+ # "std_output.rda"
108+ # ))
109+ #
110+ # stockplotr::table_landings(
111+ # dat = out_new,
112+ # make_rda = TRUE,
113+ # module = "CATCH"
114+ # )
115+ #
116+ # # rerender tables doc, appending new table
117+ # create_tables_doc(
118+ # subdir = file.path(getwd(), "report"),
119+ # tables_dir = getwd()
120+ # )
121+ #
122+ # # read in tables doc
123+ # table_content <- readLines(file.path(getwd(), "report", "08_tables.qmd"))
124+ # # extract first 8 lines
125+ # head_table_content <- head(table_content, 8)
126+ # # remove line numbers and collapse
127+ # fc_pasted <- paste(head_table_content, collapse = "")
128+ #
129+ # # expected tables doc head
130+ # expected_head_table_content <- "# Tables {#sec-tables} ```{r} #| label: 'set-rda-dir-tbls'#| echo: false #| warning: false #| include: false"
131+ #
132+ # # test expectation of start of tables doc
133+ # expect_equal(
134+ # fc_pasted,
135+ # expected_head_table_content
136+ # )
137+ #
138+ # # erase temporary testing files
139+ # file.remove(fs::path(getwd(), "08_tables.qmd"))
140+ # file.remove(fs::path(getwd(), "captions_alt_text.csv"))
141+ # unlink(fs::path(getwd(), "tables"), recursive = T)
142+ # unlink(fs::path(getwd(), "report"), recursive = T)
143+ # })
0 commit comments