pitwall-tauri 0.1.0

Tauri integration for Pitwall telemetry library
Documentation
//! TypeScript Generation Validation Test
//!
//! Validates that pitwall types implement the necessary traits for TypeScript
//! type generation via tauri-specta.
//!
//! NOTE: Actual TypeScript file generation is done in the end-user's Tauri
//! application (typically in main.rs with #[cfg(debug_assertions)]), not in
//! the library itself.

use pitwall_tauri::{SessionInfo, UpdateRate, VariableInfo, VariableSchema, VariableType};

#[test]
fn test_types_implement_specta_type_trait() {
    // This test validates that all key types implement specta::Type,
    // which is required for TypeScript generation.
    //
    // In a real Tauri application, users would generate bindings like this:
    //
    // #[cfg(debug_assertions)]
    // {
    //     tauri_specta::ts::export(
    //         specta::collect_types![start_telemetry],
    //         "../src/bindings.ts"
    //     ).expect("Failed to export TypeScript bindings");
    // }

    use specta::Type;

    fn assert_exportable<T: Type>() {}

    // Verify all key Pitwall types are exportable to TypeScript
    assert_exportable::<SessionInfo>();
    assert_exportable::<UpdateRate>();
    assert_exportable::<VariableSchema>();
    assert_exportable::<VariableInfo>();
    assert_exportable::<VariableType>();
}

#[test]
fn test_types_implement_serialize() {
    // Tauri IPC requires Serialize trait
    use serde::Serialize;

    fn assert_serializable<T: Serialize>() {}

    // Verify all types can be sent over Tauri IPC channels
    assert_serializable::<SessionInfo>();
    assert_serializable::<UpdateRate>();
    assert_serializable::<VariableSchema>();
    assert_serializable::<VariableInfo>();
    assert_serializable::<VariableType>();
}