Skip to content

Commit 804d95b

Browse files
committed
test(fetcher/github/action_status): cover render_body Entries shape for the classified status/branch/conclusion rows and the conclusion ? fallback when a still-running workflow has no conclusion
1 parent 128d0d6 commit 804d95b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

‎src/fetcher/github/action_status.rs‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,37 @@ mod tests {
368368
assert_eq!(e.items[0].status, Some(Status::Warn));
369369
}
370370

371+
#[test]
372+
fn render_entries_lists_classified_status_branch_and_conclusion() {
373+
assert!(matches!(
374+
render_body(&run("completed", Some("failure")), Shape::Entries),
375+
Body::Entries(e)
376+
if e.items.len() == 3
377+
&& e.items[0].key == "status"
378+
&& e.items[0].status == Some(Status::Error)
379+
&& e.items[0].value.as_deref() == Some("failing")
380+
&& e.items[1].key == "branch"
381+
&& e.items[1].status.is_none()
382+
&& e.items[1].value.as_deref() == Some("main")
383+
&& e.items[2].key == "conclusion"
384+
&& e.items[2].value.as_deref() == Some("failure"),
385+
));
386+
}
387+
388+
#[test]
389+
fn render_entries_conclusion_falls_back_to_question_mark_when_absent() {
390+
// A still-running workflow has no `conclusion`; the Entries row must degrade to `?`
391+
// rather than carry an empty string.
392+
assert!(matches!(
393+
render_body(&run("in_progress", None), Shape::Entries),
394+
Body::Entries(e)
395+
if e.items[0].value.as_deref() == Some("running")
396+
&& e.items[0].status == Some(Status::Warn)
397+
&& e.items[2].key == "conclusion"
398+
&& e.items[2].value.as_deref() == Some("?"),
399+
));
400+
}
401+
371402
#[test]
372403
fn render_text_falls_back_to_question_mark_for_missing_branch() {
373404
let body = render_body(

0 commit comments

Comments
 (0)