Skip to content

Commit

Permalink
fixing unit tests due to renaming or mispelling
Browse files Browse the repository at this point in the history
  • Loading branch information
RayStick committed Nov 22, 2024
1 parent d9eb841 commit b696f71
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions R/map_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ map_metadata <- function(
dataset_name <- dataset$label

## Read in prepared output data frames
data("log_output_df")
data("output_df")
log_output_df <- get("log_output_df")
output_df <- get("output_df")

## Use 'ref_plot.R' to plot domains for the user's ref (save df for later use)
df_plots <- ref_plot(data$domains)
Expand Down
4 changes: 2 additions & 2 deletions R/map_metadata_compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ map_metadata_compare <- function(session_dir, session1_base, session2_base, json
# JOIN DATAFRAMES FROM SESSIONS IN ORDER TO COMPARE ----
ses_join <- join_outputs(session_1 = csv_1b, session_2 = csv_2b)

# FIND MISMATCHES AND ASK FOR CONSENSUS DECISION ----
# FIND MISMATCHES AND ASK FOR CONCENSUS DECISION ----
for (datavar in 1:nrow(ses_join)) {
consensus <- consensus_on_mismatch(ses_join, table_df, datavar, max(df_plots$code$code))
consensus <- concensus_on_mismatch(ses_join, table_df, datavar, max(df_plots$code$code))
ses_join$domain_code_join[datavar] <- consensus$domain_code_join
ses_join$note_join[datavar] <- consensus$note_join
} # end of loop for DataElement
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-end_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library(dplyr) # add_row

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

df <- df %>% add_row(
timestamp = format(Sys.time(), "%Y-%m-%d-%H-%M-%S"),
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-user_categorisation_loop.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
library(testthat) # test_that, expect_equal
library(mockery) # mock, stub

output <- get("output")
output_df <- get("output_df")
code <- data.frame(code = 0:2)
df_plots <- list(code = code, "")

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

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

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

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

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

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

# Check the result
expect_equal(nrow(result), 2)
Expand Down

0 comments on commit b696f71

Please sign in to comment.