test: wire the handler property tests and make the proptest recipe run them

handler_proptest.rs was committed without ever being declared as a module, and it imported a list_size strategy that did not exist, so it never compiled. The proptest recipe filtered on a test name substring that matched no test.

Declare the module, add the two strategies it needs, and pass both property test filters to libtest so the recipe runs the ui and handler property tests.
This commit is contained in:
Dark-Alex-17 committed 2026-09-16 14:28:30 -06:00
1 parent d3a959d2dd
commit 87edf1fb9e
4 files changed
+54 -32

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ doctest:
# Run all proptests
[group: 'test']
proptest:
@cargo test proptest
@cargo test -- property_tests proptest
alias test-snapshots := snapshot-tests
# Run all snapshot tests
+37 -30
View File
@@ -3,7 +3,9 @@ mod property_tests {
use proptest::prelude::*;
use crate::app::App;
use crate::handlers::handler_test_utils::test_utils::proptest_helpers::*;
use crate::handlers::handler_test_utils::test_utils::proptest_helpers::{
list_size, text_input_string,
};
use crate::models::radarr_models::Movie;
use crate::models::servarr_data::radarr::radarr_data::ActiveRadarrBlock;
use crate::models::stateful_table::StatefulTable;
@@ -16,11 +18,12 @@ mod property_tests {
index in 0usize..1000
) {
let mut table = StatefulTable::<Movie>::default();
let movies: Vec<Movie> = (0..list_size).map(|i| {
let mut movie = Movie::default();
movie.id = i as i64;
movie
}).collect();
let movies: Vec<Movie> = (0..list_size)
.map(|i| Movie {
id: i as i64,
..Movie::default()
})
.collect();
table.set_items(movies);
@@ -39,11 +42,12 @@ mod property_tests {
scroll_amount in 0usize..20
) {
let mut table = StatefulTable::<Movie>::default();
let movies: Vec<Movie> = (0..list_size).map(|i| {
let mut movie = Movie::default();
movie.id = i as i64;
movie
}).collect();
let movies: Vec<Movie> = (0..list_size)
.map(|i| Movie {
id: i as i64,
..Movie::default()
})
.collect();
table.set_items(movies);
let initial_id = table.current_selection().id;
@@ -76,7 +80,7 @@ mod property_tests {
let mut app = App::test_default();
let initial_route = app.get_current_route();
let routes = vec![
let routes = [
ActiveRadarrBlock::Movies,
ActiveRadarrBlock::Collections,
ActiveRadarrBlock::Downloads,
@@ -111,15 +115,16 @@ mod property_tests {
#[test]
fn test_table_data_integrity(
list_size in 1usize..100
list_size in list_size()
) {
let mut table = StatefulTable::<Movie>::default();
let movies: Vec<Movie> = (0..list_size).map(|i| {
let mut movie = Movie::default();
movie.id = i as i64;
movie.title = format!("Movie {}", i).into();
movie
}).collect();
let movies: Vec<Movie> = (0..list_size)
.map(|i| Movie {
id: i as i64,
title: format!("Movie {i}").into(),
..Movie::default()
})
.collect();
table.set_items(movies.clone());
let original_count = table.items.len();
@@ -137,11 +142,12 @@ mod property_tests {
page_ops in 0usize..10
) {
let mut table = StatefulTable::<Movie>::default();
let movies: Vec<Movie> = (0..list_size).map(|i| {
let mut movie = Movie::default();
movie.id = i as i64;
movie
}).collect();
let movies: Vec<Movie> = (0..list_size)
.map(|i| Movie {
id: i as i64,
..Movie::default()
})
.collect();
table.set_items(movies);
@@ -164,12 +170,13 @@ mod property_tests {
filter_term in text_input_string()
) {
let mut table = StatefulTable::<Movie>::default();
let movies: Vec<Movie> = (0..list_size).map(|i| {
let mut movie = Movie::default();
movie.id = i as i64;
movie.title = format!("Test Movie {}", i % 10).into();
movie
}).collect();
let movies: Vec<Movie> = (0..list_size)
.map(|i| Movie {
id: i as i64,
title: format!("Test Movie {}", i % 10).into(),
..Movie::default()
})
.collect();
table.set_items(movies.clone());
let original_size = table.items.len();
+13 -1
View File
@@ -1,6 +1,6 @@
#[cfg(test)]
#[macro_use]
mod test_utils {
pub mod test_utils {
#[macro_export]
macro_rules! simple_stateful_iterable_vec {
($name:ident) => {
@@ -411,4 +411,16 @@ mod test_utils {
);
};
}
pub mod proptest_helpers {
use proptest::prelude::*;
pub fn list_size() -> impl Strategy<Value = usize> {
1usize..100
}
pub fn text_input_string() -> impl Strategy<Value = String> {
"\\PC{0,50}"
}
}
}
+3
View File
@@ -26,6 +26,9 @@ mod sonarr_handlers;
#[path = "handlers_tests.rs"]
mod handlers_tests;
#[cfg(test)]
mod handler_proptest;
#[cfg(test)]
#[path = "handler_test_utils.rs"]
pub mod handler_test_utils;