story-kit: merge 353_story_add_party_emoji_to_done_stage_notification_messages

This commit is contained in:
Dave
2026-03-20 11:22:34 +00:00
parent ab5fb734e5
commit c096488ba1

View File

@@ -73,9 +73,10 @@ pub fn format_stage_notification(
let number = extract_story_number(item_id).unwrap_or(item_id); let number = extract_story_number(item_id).unwrap_or(item_id);
let name = story_name.unwrap_or(item_id); let name = story_name.unwrap_or(item_id);
let plain = format!("#{number} {name} \u{2014} {from_stage} \u{2192} {to_stage}"); let prefix = if to_stage == "Done" { "\u{1f389} " } else { "" };
let plain = format!("{prefix}#{number} {name} \u{2014} {from_stage} \u{2192} {to_stage}");
let html = format!( let html = format!(
"<strong>#{number}</strong> <em>{name}</em> \u{2014} {from_stage} \u{2192} {to_stage}" "{prefix}<strong>#{number}</strong> <em>{name}</em> \u{2014} {from_stage} \u{2192} {to_stage}"
); );
(plain, html) (plain, html)
} }
@@ -320,6 +321,35 @@ mod tests {
// ── format_stage_notification ─────────────────────────────────────────── // ── format_stage_notification ───────────────────────────────────────────
#[test]
fn format_notification_done_stage_includes_party_emoji() {
let (plain, html) = format_stage_notification(
"353_story_done",
Some("Done Story"),
"Merge",
"Done",
);
assert_eq!(
plain,
"\u{1f389} #353 Done Story \u{2014} Merge \u{2192} Done"
);
assert_eq!(
html,
"\u{1f389} <strong>#353</strong> <em>Done Story</em> \u{2014} Merge \u{2192} Done"
);
}
#[test]
fn format_notification_non_done_stage_has_no_emoji() {
let (plain, _html) = format_stage_notification(
"42_story_thing",
Some("Some Story"),
"Backlog",
"Current",
);
assert!(!plain.contains("\u{1f389}"));
}
#[test] #[test]
fn format_notification_with_story_name() { fn format_notification_with_story_name() {
let (plain, html) = format_stage_notification( let (plain, html) = format_stage_notification(