2
2
library(testthat ) # test_that, expect_equal
3
3
library(mockery ) # mock, stub
4
4
5
- output <- get(" output " )
5
+ output_df <- get(" output_df " )
6
6
code <- data.frame (code = 0 : 2 )
7
7
df_plots <- list (code = code , " " )
8
8
@@ -12,7 +12,7 @@ test_that("user_categorisation_loop handles auto categorisation", {
12
12
lookup <- data.frame (data_element = c(" Element1" , " Element2" ), domain_code = c(1 , 2 ))
13
13
14
14
# 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 )
16
16
17
17
# Check the result
18
18
expect_equal(nrow(result ), 2 )
@@ -27,7 +27,7 @@ test_that("user_categorisation_loop handles copying from previous table", {
27
27
lookup <- data.frame (data_element = c(" Element3" , " Element4" ), domain_code = c(3 , 4 ))
28
28
29
29
# 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 )
31
31
32
32
# Check the result
33
33
expect_equal(nrow(result ), 2 )
@@ -45,7 +45,7 @@ test_that("user_categorisation_loop handles user categorisation", {
45
45
stub(user_categorisation_loop , " user_categorisation" , mock_user_categorisation )
46
46
47
47
# 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 )
49
49
50
50
# Check the result
51
51
expect_equal(nrow(result ), 2 )
0 commit comments