[tests] Day 2: splits, share links, sharing boundary, QR Platba, Shortcut posts, bank notifications, household duplicates

This commit is contained in:
2026-11-03 23:27:26 +01:00
parent 8e085bafc3
commit b4474f288e
6 changed files with 676 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
//! Day 2: household duplicates ("you both pay Spotify"), only from names members chose to share.
use fiscus_insight::household::{household_duplicates, Duplicate};
fn names(v: &[&str]) -> Vec<String> {
v.iter().map(|s| s.to_string()).collect()
}
#[test]
fn two_members_paying_the_same_service_is_a_duplicate() {
let shared = vec![
("mark".to_string(), names(&["PAYPAL *SPOTIFY", "Netflix.com", "O2 Czech"])),
("jana".to_string(), names(&["Spotify AB", "Netflix"])),
("kid".to_string(), names(&["Spotify"])),
];
let d = household_duplicates(&shared);
assert_eq!(
d,
vec![
Duplicate { key: "netflix".into(), members: vec!["jana".into(), "mark".into()] },
Duplicate { key: "spotify".into(), members: vec!["jana".into(), "kid".into(), "mark".into()] },
]
);
}
#[test]
fn one_member_alone_or_nobody_sharing_is_nothing() {
assert!(household_duplicates(&[]).is_empty());
let one = vec![("mark".to_string(), names(&["Spotify", "spotify", "PAYPAL *SPOTIFY"]))];
assert!(household_duplicates(&one).is_empty(), "the same member twice is not a duplicate");
}