const NEW_MAX: i64 = 6;
const FAMILIAR_MIN: i64 = 200;
pub fn familiarity_hint(message_count: i64) -> Option<&'static str> {
if message_count < NEW_MAX {
Some(
"This looks like one of your first conversations with this person. Be welcoming and a \
touch more explicit — you don't share much history yet, so don't assume prior context.",
)
} else if message_count >= FAMILIAR_MIN {
Some(
"You and this person go back a long way. You can be relaxed and familiar, and lean on \
the history and context you already share.",
)
} else {
None
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn new_chats_get_a_welcoming_nudge() {
assert!(familiarity_hint(0).unwrap().contains("first conversations"));
assert!(familiarity_hint(5).is_some());
}
#[test]
fn the_middle_stays_silent() {
assert!(familiarity_hint(6).is_none());
assert!(familiarity_hint(50).is_none());
assert!(familiarity_hint(199).is_none());
}
#[test]
fn long_running_chats_get_a_familiar_nudge() {
assert!(familiarity_hint(200)
.unwrap()
.contains("go back a long way"));
assert!(familiarity_hint(5000).is_some());
}
}