church-core/src/bin/test_consolidation.rs
Benjamin Slingo 9daf11c5af
Some checks failed
iOS UniFFI Build / build-ios (push) Has been cancelled
Consolidate web functionality into main church-core crate
- Add api.rs with all web-specific API functions
- Add admin_login and validate_admin_token methods to ChurchApiClient
- Add image fields to EventSubmission model
- Add submit_event_with_image and submit_event_multipart functions
- Update test files for new EventSubmission fields

This consolidates the web church-core into the main crate to achieve single source of truth.
2025-08-30 08:49:49 -04:00

46 lines
1.9 KiB
Rust

// Test to verify all consolidated functions are available
use church_core::{
ChurchApiClient, ChurchCoreConfig,
// Test that API functions are exported
fetch_events_json, fetch_sermons_json, submit_event_json,
admin_login_json, validate_admin_token_json,
// Test that models have new fields
models::EventSubmission,
};
fn main() {
println!("✅ All imports successful!");
// Test EventSubmission has new image fields
let submission = EventSubmission {
title: "Test".to_string(),
description: "Test".to_string(),
start_time: "2025-01-01T10:00:00Z".to_string(),
end_time: "2025-01-01T11:00:00Z".to_string(),
location: "Test".to_string(),
location_url: None,
category: "Other".to_string(),
is_featured: false,
recurring_type: None,
bulletin_week: None,
submitter_email: "test@test.com".to_string(),
image_data: Some(vec![1, 2, 3, 4]), // NEW FIELD
image_filename: Some("test.jpg".to_string()), // NEW FIELD
image_mime_type: Some("image/jpeg".to_string()), // NEW FIELD
};
println!("✅ EventSubmission with image fields created successfully!");
// Test that we can create a client and that admin methods exist
let config = ChurchCoreConfig::default();
let client = ChurchApiClient::new(config).expect("Failed to create client");
println!("✅ ChurchApiClient created successfully!");
// Verify admin methods exist (just check they compile, don't actually call them)
let _has_admin_login = client.admin_login("test", "test");
let _has_validate_token = client.validate_admin_token("test");
let _has_submit_multipart = church_core::client::events::submit_event_with_image(&client, submission, None);
println!("✅ All admin and multipart functions compile successfully!");
println!("🎉 Consolidation test PASSED - all functions available!");
}