Skip to content

Commit b696f71

Browse files
committed
fixing unit tests due to renaming or mispelling
1 parent d9eb841 commit b696f71

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

R/map_metadata.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ map_metadata <- function(
6969
dataset_name <- dataset$label
7070

7171
## Read in prepared output data frames
72-
data("log_output_df")
73-
data("output_df")
72+
log_output_df <- get("log_output_df")
73+
output_df <- get("output_df")
7474

7575
## Use 'ref_plot.R' to plot domains for the user's ref (save df for later use)
7676
df_plots <- ref_plot(data$domains)

R/map_metadata_compare.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ map_metadata_compare <- function(session_dir, session1_base, session2_base, json
119119
# JOIN DATAFRAMES FROM SESSIONS IN ORDER TO COMPARE ----
120120
ses_join <- join_outputs(session_1 = csv_1b, session_2 = csv_2b)
121121

122-
# FIND MISMATCHES AND ASK FOR CONSENSUS DECISION ----
122+
# FIND MISMATCHES AND ASK FOR CONCENSUS DECISION ----
123123
for (datavar in 1:nrow(ses_join)) {
124-
consensus <- consensus_on_mismatch(ses_join, table_df, datavar, max(df_plots$code$code))
124+
consensus <- concensus_on_mismatch(ses_join, table_df, datavar, max(df_plots$code$code))
125125
ses_join$domain_code_join[datavar] <- consensus$domain_code_join
126126
ses_join$note_join[datavar] <- consensus$note_join
127127
} # end of loop for DataElement

tests/testthat/test-end_plot.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ library(dplyr) # add_row
55

66
test_that("end_plot function works correctly", {
77
# Sample data frame
8-
df <- get("output")
8+
df <- get("output_df")
99

1010
df <- df %>% add_row(
1111
timestamp = format(Sys.time(), "%Y-%m-%d-%H-%M-%S"),

tests/testthat/test-user_categorisation_loop.R

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
library(testthat) # test_that, expect_equal
33
library(mockery) # mock, stub
44

5-
output <- get("output")
5+
output_df <- get("output_df")
66
code <- data.frame(code = 0:2)
77
df_plots <- list(code = code, "")
88

@@ -12,7 +12,7 @@ test_that("user_categorisation_loop handles auto categorisation", {
1212
lookup <- data.frame(data_element = c("Element1", "Element2"), domain_code = c(1, 2))
1313

1414
# Call the function
15-
result <- user_categorisation_loop(1, 2, table_df, FALSE, data.frame(), lookup, df_plots, output)
15+
result <- user_categorisation_loop(1, 2, table_df, FALSE, data.frame(), lookup, df_plots, output_df)
1616

1717
# Check the result
1818
expect_equal(nrow(result), 2)
@@ -27,7 +27,7 @@ test_that("user_categorisation_loop handles copying from previous table", {
2727
lookup <- data.frame(data_element = c("Element3", "Element4"), domain_code = c(3, 4))
2828

2929
# Call the function
30-
result <- user_categorisation_loop(1, 2, table_df, TRUE, df_prev, lookup, df_plots, output)
30+
result <- user_categorisation_loop(1, 2, table_df, TRUE, df_prev, lookup, df_plots, output_df)
3131

3232
# Check the result
3333
expect_equal(nrow(result), 2)
@@ -45,7 +45,7 @@ test_that("user_categorisation_loop handles user categorisation", {
4545
stub(user_categorisation_loop, "user_categorisation", mock_user_categorisation)
4646

4747
# Call the function
48-
result <- user_categorisation_loop(1, 2, table_df, FALSE, data.frame(), lookup, df_plots, output)
48+
result <- user_categorisation_loop(1, 2, table_df, FALSE, data.frame(), lookup, df_plots, output_df)
4949

5050
# Check the result
5151
expect_equal(nrow(result), 2)

0 commit comments

Comments
 (0)