Skip to content

Commit dc24068

Browse files
committed
Fix: Addressed CI errors
1 parent eda887a commit dc24068

File tree

5 files changed

+33
-29
lines changed

5 files changed

+33
-29
lines changed

src/graphql/email.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,8 @@ mod tests {
911911
#[tokio::test]
912912
async fn test_email_validation_caching() {
913913
// Create a test Redis client with a short TTL
914-
let email_query = EmailQuery::new("redis://127.0.0.1:6379", 5).unwrap_or_else(|_| EmailQuery::default());
914+
let email_query =
915+
EmailQuery::new("redis://127.0.0.1:6379", 5).unwrap_or_else(|_| EmailQuery::default());
915916

916917
let test_email = "test@example.com";
917918

@@ -994,7 +995,10 @@ mod tests {
994995
assert_eq!(original.is_valid, converted.is_valid);
995996
assert_eq!(original.status, converted.status);
996997
assert!(original.error.is_some() && converted.error.is_some());
997-
assert_eq!(original.error.as_ref().unwrap().code, converted.error.as_ref().unwrap().code);
998+
assert_eq!(
999+
original.error.as_ref().unwrap().code,
1000+
converted.error.as_ref().unwrap().code
1001+
);
9981002
}
9991003

10001004
#[tokio::test]

src/graphql/schema.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ mod tests {
130130
// Just ensure we can create a default instance
131131
// This tests the Default trait implementation
132132
let schema = Schema::build(root_query, EmptyMutation, EmptySubscription).finish();
133-
133+
134134
let query = "{ health { status } }";
135135
let result = tokio_test::block_on(schema.execute(query));
136136
assert!(result.errors.is_empty());
@@ -161,7 +161,11 @@ mod tests {
161161
"#;
162162

163163
let result = tokio_test::block_on(schema.execute(query));
164-
assert!(result.errors.is_empty(), "GraphQL query has errors: {:?}", result.errors);
164+
assert!(
165+
result.errors.is_empty(),
166+
"GraphQL query has errors: {:?}",
167+
result.errors
168+
);
165169

166170
let data = result.data.into_json().unwrap();
167171
assert!(data["validateEmailsBulk"]["results"].is_array());

src/routes/email.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ mod tests {
302302
async fn test_role_based_email_detection_when_enabled() {
303303
// Load environment variables from .env file for test
304304
dotenv::dotenv().ok();
305-
305+
306306
let app = create_test_app().await;
307307
let req = test::TestRequest::post()
308308
.uri("/validate-email?check_role_based=true")
@@ -387,11 +387,11 @@ mod tests {
387387
#[actix_web::test]
388388
async fn test_redis_cache_methods() {
389389
let redis_cache = RedisCache::test_dummy();
390-
390+
391391
// Test get_dns_validation with cache miss
392392
let result = redis_cache.get_dns_validation("example.com").await;
393393
assert!(result.is_ok());
394-
394+
395395
// Test set_dns_validation
396396
let result = redis_cache.set_dns_validation("example.com", true).await;
397397
assert!(result.is_ok());
@@ -402,7 +402,7 @@ mod tests {
402402
// Test with valid Redis URL
403403
let result = RedisCache::new("redis://127.0.0.1:6379", 3600);
404404
assert!(result.is_ok() || result.is_err()); // Either works or fails gracefully
405-
405+
406406
// Test with invalid Redis URL
407407
let result = RedisCache::new("invalid://url", 3600);
408408
assert!(result.is_err());
@@ -416,15 +416,16 @@ mod tests {
416416
let app = test::init_service(
417417
App::new()
418418
.app_data(web::Data::new(RedisCache::test_dummy()))
419-
.configure(configure_routes)
420-
).await;
421-
419+
.configure(configure_routes),
420+
)
421+
.await;
422+
422423
// Test that the routes are configured by making a request
423424
let req = test::TestRequest::post()
424425
.uri("/validate-email")
425426
.set_json(json!({ "email": "test@example.com" }))
426427
.to_request();
427-
428+
428429
let resp = test::call_service(&app, req).await;
429430
// Should not be 404 (not found), meaning route is configured
430431
assert_ne!(resp.status().as_u16(), 404);

src/routes/graphql.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,31 @@ pub fn configure_routes(cfg: &mut web::ServiceConfig) {
1313
mod tests {
1414
use super::*;
1515
use crate::graphql::schema::create_schema;
16-
use actix_web::{test, App, web};
16+
use actix_web::{App, test, web};
1717

1818
#[actix_web::test]
1919
async fn test_configure_routes() {
2020
let schema = create_schema();
21-
21+
2222
let app = test::init_service(
2323
App::new()
2424
.app_data(web::Data::new(schema))
25-
.configure(configure_routes)
26-
).await;
25+
.configure(configure_routes),
26+
)
27+
.await;
2728

2829
// Test GraphQL endpoint
2930
let req = test::TestRequest::post()
3031
.uri("/graphql")
3132
.set_json(serde_json::json!({"query": "{ __typename }"}))
3233
.to_request();
33-
34+
3435
let resp = test::call_service(&app, req).await;
3536
assert_eq!(resp.status(), 200);
3637

3738
// Test playground endpoint
38-
let req = test::TestRequest::get()
39-
.uri("/playground")
40-
.to_request();
41-
39+
let req = test::TestRequest::get().uri("/playground").to_request();
40+
4241
let resp = test::call_service(&app, req).await;
4342
assert_eq!(resp.status(), 200);
4443
}

src/routes/health.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,11 @@ mod tests {
104104
async fn test_configure_routes_function() {
105105
// Test that configure_routes function exists and can be called
106106
// We test through the app initialization since ServiceConfig::new is private
107-
let app = test::init_service(
108-
App::new().configure(configure_routes)
109-
).await;
110-
107+
let app = test::init_service(App::new().configure(configure_routes)).await;
108+
111109
// Test that the health route is configured by making a request
112-
let req = test::TestRequest::get()
113-
.uri("/health")
114-
.to_request();
115-
110+
let req = test::TestRequest::get().uri("/health").to_request();
111+
116112
let resp = test::call_service(&app, req).await;
117113
// Should be 200 OK, meaning route is configured correctly
118114
assert_eq!(resp.status().as_u16(), 200);

0 commit comments

Comments
 (0)