Skip to content

Commit 6babd5e

Browse files
committed
test(status): add strip_ansi helper for ANSI code removal
1 parent 92730b8 commit 6babd5e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/topics/status.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,10 @@ mod tests {
733733
TopicsProjectSummary,
734734
};
735735

736+
fn strip_ansi(s: &str) -> String {
737+
console::strip_ansi_codes(s).to_string()
738+
}
739+
736740
fn sample_report() -> TopicsStatusReport {
737741
TopicsStatusReport {
738742
project: TopicsProjectSummary {
@@ -880,7 +884,7 @@ mod tests {
880884

881885
#[test]
882886
fn compact_report_includes_summary_details() {
883-
let output = render_report(&sample_report(), false);
887+
let output = strip_ansi(&render_report(&sample_report(), false));
884888
assert!(output.contains("Project:"));
885889
assert!(!output.contains("Topic automations: 1"));
886890
assert!(output.contains("demo-project (proj_123)"));
@@ -899,7 +903,7 @@ mod tests {
899903

900904
#[test]
901905
fn full_report_includes_diagnostics_and_flow() {
902-
let output = render_report(&sample_report(), true);
906+
let output = strip_ansi(&render_report(&sample_report(), true));
903907
assert!(output.contains("details:"));
904908
assert!(output.contains(" scope: trace"));
905909
assert!(output.contains(" state since: "));
@@ -966,7 +970,7 @@ mod tests {
966970
second.name = "Topics copy".to_string();
967971
report.automations.push(second);
968972

969-
let output = render_report(&report, false);
973+
let output = strip_ansi(&render_report(&report, false));
970974
assert!(output.contains("Topic automations: 2"));
971975
assert!(output.contains("\n---\n\nTopics copy (auto_456)"));
972976
}

0 commit comments

Comments
 (0)