diff --git a/src/safe_outputs/comment_on_work_item.rs b/src/safe_outputs/comment_on_work_item.rs index 7adab3ae..5d64b116 100644 --- a/src/safe_outputs/comment_on_work_item.rs +++ b/src/safe_outputs/comment_on_work_item.rs @@ -387,7 +387,11 @@ mod tests { body: "This is a valid comment body text.".to_string(), }; let result: Result = params.try_into(); - assert!(result.is_err()); + let err = result.unwrap_err().to_string(); + assert!( + err.contains("work_item_id must be positive"), + "unexpected error: {err}" + ); } #[test] @@ -397,7 +401,11 @@ mod tests { body: "This is a valid comment body text.".to_string(), }; let result: Result = params.try_into(); - assert!(result.is_err()); + let err = result.unwrap_err().to_string(); + assert!( + err.contains("work_item_id must be positive"), + "unexpected error: {err}" + ); } #[test] @@ -407,7 +415,11 @@ mod tests { body: "Too short".to_string(), }; let result: Result = params.try_into(); - assert!(result.is_err()); + let err = result.unwrap_err().to_string(); + assert!( + err.contains("body must be at least 10 characters"), + "unexpected error: {err}" + ); } #[test] diff --git a/src/safe_outputs/create_git_tag.rs b/src/safe_outputs/create_git_tag.rs index 92a88df5..2dd8f1e9 100644 --- a/src/safe_outputs/create_git_tag.rs +++ b/src/safe_outputs/create_git_tag.rs @@ -463,7 +463,11 @@ mod tests { repository: None, }; let result: Result = params.try_into(); - assert!(result.is_err()); + let err = result.unwrap_err().to_string(); + assert!( + err.contains("message must be at least 5 characters"), + "unexpected error: {err}" + ); } #[test] @@ -475,7 +479,11 @@ mod tests { repository: Some("##vso[task.setvariable variable=x]y".to_string()), }; let result: Result = params.try_into(); - assert!(result.is_err()); + let err = result.unwrap_err().to_string(); + assert!( + err.contains("pipeline command"), + "unexpected error: {err}" + ); } #[test]