Split has_content test into three cases per reviewer request
Separate tests for empty/whitespace/non-blank input so a regression points at the exact case that broke instead of a single bundled test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJJQb2DWZZwQ1yPiaAQQoY
This commit is contained in:
parent
8d316408b8
commit
e621720e47
1 changed files with 13 additions and 3 deletions
|
|
@ -74,12 +74,22 @@ fn estimate_read_seconds(text: &str) -> u32 {
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// A blank or whitespace-only feed title should be treated the same as
|
/// An empty feed title should be treated the same as a missing one.
|
||||||
/// a missing one, not surfaced as an empty string in the UI.
|
|
||||||
#[test]
|
#[test]
|
||||||
fn has_content_rejects_blank_strings() {
|
fn has_content_rejects_empty_string() {
|
||||||
assert!(!has_content(""));
|
assert!(!has_content(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A whitespace-only feed title should be treated the same as a
|
||||||
|
/// missing one, not surfaced as a blank-looking name in the UI.
|
||||||
|
#[test]
|
||||||
|
fn has_content_rejects_whitespace_only_string() {
|
||||||
assert!(!has_content(" \n\t"));
|
assert!(!has_content(" \n\t"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A real title is accepted as-is.
|
||||||
|
#[test]
|
||||||
|
fn has_content_accepts_non_blank_string() {
|
||||||
assert!(has_content("Rust Blog"));
|
assert!(has_content("Rust Blog"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue