Skip to content

Commit 47c46c7

Browse files
test: fix vacuous assertions in audit analyzer tests (#885)
same total_tokens value in the implementation, making the original comparison self-referential and unable to catch regressions; also pin turns == 2 from the fixture instead of just > 0. with assertions on actual noop context and reason values — extract_noops unconditionally sets tool: None, so the original assertion could never fail; new assertions verify context routing and the description→reason fallback for the third noop entry. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c7226fe commit 47c46c7

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/audit/analyzers/missing.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ mod tests {
215215
assert_eq!(noops.len(), 3);
216216
assert_eq!(missing_tools[0].tool.as_deref(), Some("bash"));
217217
assert_eq!(missing_tools[1].tool.as_deref(), Some("python"));
218-
assert!(noops.iter().all(|report| report.tool.is_none()));
218+
assert_eq!(noops[0].context.as_deref(), Some("ctx-4"));
219+
assert_eq!(noops[0].reason.as_deref(), Some("nothing to do"));
220+
assert_eq!(noops[1].context.as_deref(), Some("ctx-5"));
221+
assert_eq!(noops[2].context.as_deref(), Some("ctx-6"));
222+
// third noop has no "reason" field — description fallback must apply
223+
assert_eq!(noops[2].reason.as_deref(), Some("skipped"));
219224
}
220225

221226
#[tokio::test]

src/audit/analyzers/otel.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,8 @@ mod tests {
158158

159159
let analysis = analyze_otel(temp_dir.path()).await.unwrap();
160160

161-
assert!(analysis.metrics.token_usage > 0);
162-
assert_eq!(
163-
analysis.metrics.effective_tokens,
164-
analysis.metrics.token_usage
165-
);
166-
assert!(analysis.metrics.turns > 0);
161+
assert_eq!(analysis.metrics.token_usage, 33185);
162+
assert_eq!(analysis.metrics.turns, 2);
167163
assert!(analysis.engine_config.is_none());
168164
assert!(analysis.aw_info.is_none());
169165
}

0 commit comments

Comments
 (0)