Skip to content

Commit 00791c8

Browse files
committed
Fix: Addressed CI pipeline errors
1 parent f2ef2d0 commit 00791c8

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ MIT License.
171171
- **DoD**: Blocklists loaded at startup, role detection accuracy >95%. ✅
172172
173173
8. **Bulk Processing**
174-
- Add async bulk validation endpoint (`POST /bulk/validate`). ✅
174+
- Add async bulk validation REST endpoint (`POST /bulk/validate`). ✅
175175
- Implement job queue (Redis or MongoDB).
176176
- **DoD**: Processes 10K emails in <5 mins, returns job status.
177177

src/routes/email.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ async fn validate_single_email(
332332
status: None,
333333
error: Some(EmailValidationError {
334334
code: "DISPOSABLE_EMAIL".to_string(),
335-
message: "The email address domain is a provider of disposable email addresses".to_string(),
335+
message: "The email address domain is a provider of disposable email addresses"
336+
.to_string(),
336337
}),
337338
},
338339
Ok(false) => EmailValidationResponse {
@@ -398,7 +399,8 @@ pub async fn validate_emails_bulk(
398399
let redis_cache = redis_cache.get_ref().clone();
399400
let check_role_based = query.check_role_based;
400401
async move {
401-
let validation = validate_single_email(&email_clone, check_role_based, &redis_cache).await;
402+
let validation =
403+
validate_single_email(&email_clone, check_role_based, &redis_cache).await;
402404
(email_clone, validation)
403405
}
404406
})
@@ -654,7 +656,7 @@ mod tests {
654656

655657
let body = test::read_body(resp).await;
656658
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
657-
659+
658660
assert!(body_json["results"].is_array());
659661
assert_eq!(body_json["results"].as_array().unwrap().len(), 2);
660662
assert!(body_json["valid_count"].is_number());
@@ -676,10 +678,10 @@ mod tests {
676678

677679
let body = test::read_body(resp).await;
678680
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
679-
681+
680682
let results = body_json["results"].as_array().unwrap();
681683
assert_eq!(results.len(), 3);
682-
684+
683685
// Check that we have both valid and invalid results
684686
let valid_count = body_json["valid_count"].as_i64().unwrap();
685687
let invalid_count = body_json["invalid_count"].as_i64().unwrap();
@@ -702,7 +704,7 @@ mod tests {
702704

703705
let body = test::read_body(resp).await;
704706
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
705-
707+
706708
let results = body_json["results"].as_array().unwrap();
707709
assert_eq!(results.len(), 2);
708710
}
@@ -720,7 +722,7 @@ mod tests {
720722

721723
let body = test::read_body(resp).await;
722724
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
723-
725+
724726
assert_eq!(body_json["results"].as_array().unwrap().len(), 0);
725727
assert_eq!(body_json["valid_count"], 0);
726728
assert_eq!(body_json["invalid_count"], 0);
@@ -741,27 +743,30 @@ mod tests {
741743

742744
let body = test::read_body(resp).await;
743745
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
744-
746+
745747
let results = body_json["results"].as_array().unwrap();
746-
748+
747749
// Find the disposable email result
748750
let disposable_result = results
749751
.iter()
750752
.find(|r| r["email"] == "user@mailinator.com")
751753
.unwrap();
752-
754+
753755
assert_eq!(disposable_result["validation"]["is_valid"], false);
754-
assert_eq!(disposable_result["validation"]["error"]["code"], "DISPOSABLE_EMAIL");
756+
assert_eq!(
757+
disposable_result["validation"]["error"]["code"],
758+
"DISPOSABLE_EMAIL"
759+
);
755760
}
756761

757762
#[actix_web::test]
758763
async fn test_validate_single_email_function() {
759764
let redis_cache = RedisCache::test_dummy();
760-
765+
761766
// Test valid email
762767
let result = validate_single_email("test@example.com", false, &redis_cache).await;
763768
assert!(result.is_valid || !result.is_valid); // Either outcome is valid for this test
764-
769+
765770
// Test invalid syntax
766771
let result = validate_single_email("invalid-email", false, &redis_cache).await;
767772
assert!(!result.is_valid);

0 commit comments

Comments
 (0)