nxtgauge-backend-rust/tests/test_helper.rs
Ashwin Kumar 7928e21a21 fix: resolve all compilation warnings and errors across services
- Remove duplicate departments/designations/employees handlers from users service (already in employees service)
- Fix all 9 profession admin handlers to use correct DB schema (display_name, bio, location, custom_data)
- Fix companies admin handler to match CompanyProfile DB model with all fields
- Fix customers admin handler to match Requirement model with preferred_date
- Fix missing serde_json imports and type annotations in admin handlers
- Add #[allow(dead_code)] for intentionally unused structs/fields
- Add test infrastructure: auth crypto tests (2 passing), test directory structure
- Zero compilation warnings across all services
2026-04-07 12:52:55 +02:00

37 lines
No EOL
1.3 KiB
Rust

use std::env;
use sqlx::{Pool, Postgres};
use nxtgauge_backend_rust::users::{AppState, router};
// Test database configuration
pub async fn setup_test_db() -> Pool<Postgres> {
// In a real test, we would use something like:
// let database_url = std::env::var("TEST_DATABASE_URL")
// .unwrap_or_else(|_| "postgres://postgres:password@localhost:5432/nxtgauge_test".to_string());
//
// Pool::connect(&database_url)
// .await
// .expect("Failed to connect to test database");
// For now, we'll return a dummy pool since we're focusing on test setup
panic!("Test database setup not implemented - this is a placeholder");
}
// Helper to create test app state
pub async fn create_test_app_state() -> AppState {
// In reality, we would:
// let pool = setup_test_db().await;
// let redis_url = std::env::var("TEST_REDIS_URL")
// .unwrap_or_else(|_| "redis://127.0.0.1:6379".to_string());
// let redis = cache::connect(&redis_url)
// .await
// .expect("Failed to connect to Redis");
// let mailer = Arc::new(Mailer::new());
//
// AppState {
// pool,
// mail: mailer,
// redis,
// }
panic!("Test app state not implemented - this is a placeholder");
}