Skip to content

Commit c7226fe

Browse files
test: correct mislabelled test in src/audit/analyzers/jobs.rs (#883)
timeline_to_jobs_parses_real_ado_shape claimed to validate "real ADO shape" parsing but only asserted on jobs.len() and name ordering — both already covered by the filtering and sorting tests. The test setup provides complete job data (result, startTime, finishTime, id, parentId) but none of those fields were verified, meaning regressions in field parsing would go undetected. Add assertions for status, result, duration, started_at, and finished_at on the first parsed job, and add a comment clarifying that extra ADO fields (id, parentId) are silently ignored. 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 11baad9 commit c7226fe

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/audit/analyzers/jobs.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ mod tests {
237237

238238
#[test]
239239
fn timeline_to_jobs_parses_real_ado_shape() {
240+
// Simulates a real ADO timeline response with extra fields (id, parentId)
241+
// that the parser should silently ignore.
240242
let timeline = json!({
241243
"records": [
242244
{
@@ -279,5 +281,13 @@ mod tests {
279281
jobs.iter().map(|job| job.name.as_str()).collect::<Vec<_>>(),
280282
vec!["Agent", "Detection", "SafeOutputs"]
281283
);
284+
285+
// Verify all fields are correctly parsed for the first job; extra ADO
286+
// fields (id, parentId) must be silently ignored.
287+
assert_eq!(jobs[0].status, "completed");
288+
assert_eq!(jobs[0].result.as_deref(), Some("succeeded"));
289+
assert_eq!(jobs[0].duration.as_deref(), Some("1m 0s"));
290+
assert_eq!(jobs[0].started_at.as_deref(), Some("2026-01-01T00:00:00Z"));
291+
assert_eq!(jobs[0].finished_at.as_deref(), Some("2026-01-01T00:01:00Z"));
282292
}
283293
}

0 commit comments

Comments
 (0)