@@ -94,6 +94,15 @@ test_that ("collate all models", {
94
94
metrics_data <- collate_all_metrics (path , end_date = end_date )
95
95
mod_dat_metrics <- collate_all_models (metrics_data = metrics_data )
96
96
97
+ metrics_all <- withr :: with_options (
98
+ list (" repometrics_period" = 365.25 / 2 ),
99
+ metrics_over_end_dates (path , end_date = end_date , num_years = 1 )
100
+ )
101
+ models_all <- withr :: with_options (
102
+ list (" repometrics_period" = 365.25 / 2 ),
103
+ models_over_end_dates (path , end_date = end_date , num_years = 1 )
104
+ )
105
+
97
106
fs :: dir_delete (path )
98
107
99
108
expect_type (mod_dat , " double" )
@@ -103,4 +112,18 @@ test_that ("collate all models", {
103
112
expect_true (length (which (is.na (mod_dat ))) < = 1L )
104
113
105
114
expect_identical (mod_dat , mod_dat_metrics )
115
+
116
+ expect_type (metrics_all , " list" )
117
+ end_dates <- withr :: with_options (
118
+ list (" repometrics_period" = 365.25 / 2 ),
119
+ get_end_date_seq (end_date = end_date , num_years = 1 )
120
+ )
121
+ expect_length (metrics_all , length (end_dates ))
122
+ expect_named (metrics_all , as.character (end_dates ))
123
+ expect_identical (names (metrics_all [[1 ]]), names (metrics_data ))
124
+
125
+ expect_s3_class (models_all , " data.frame" )
126
+ expect_equal (nrow (models_all ), length (end_dates ))
127
+ model_fns <- get_cm_fns (" model" )
128
+ expect_named (models_all , c (" date" , gsub (" cm\\ _model\\ _" , " " , model_fns )))
106
129
})
0 commit comments