Files
foxhunt/crates/common/src/sqlx_test.rs
jgrusewski 9c3d741a08 refactor: restructure repo — crates/, bin/, testing/ layout
Move 17 library crates into crates/, CLI binary into bin/fxt,
consolidate 10 test crates into testing/, split config crate
from deployment config files.

Root directory reduced from 38+ to ~17 directories.
All Cargo.toml paths and build.rs proto refs updated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 11:56:00 +01:00

93 lines
3.1 KiB
Rust

//! SQLx trait implementation tests for identifier types
//! Temporarily disabled due to incomplete SQLx trait implementations
// TODO: Re-enable once SQLx traits are properly implemented for all types
/*
#[cfg(all(test, feature = "database"))]
mod tests {
use crate::types::*;
use sqlx::{Postgres, TypeInfo};
/// Test OrderId SQLx serialization/deserialization
#[test]
fn test_order_id_sqlx() {
let order_id = OrderId::new();
// Test that OrderId can be used in SQLx queries (compile-time check)
let type_info = <OrderId as sqlx::Type<Postgres>>::type_info();
let _: bool = sqlx::types::Type::<Postgres>::compatible(&type_info);
}
/// Test TradeId SQLx serialization/deserialization
#[test]
fn test_trade_id_sqlx() -> Result<(), Box<dyn std::error::Error>> {
let trade_id = TradeId::new("TRADE-001")?;
// Test that TradeId can be used in SQLx queries (compile-time check)
let type_info = <TradeId as sqlx::Type<Postgres>>::type_info();
let _: bool = sqlx::types::Type::<Postgres>::compatible(&type_info);
Ok(())
}
/// Test Symbol SQLx serialization/deserialization
#[test]
fn test_symbol_sqlx() -> Result<(), Box<dyn std::error::Error>> {
let symbol = Symbol::new_validated("AAPL".to_owned())?;
// Test that Symbol can be used in SQLx queries (compile-time check)
let type_info = <Symbol as sqlx::Type<Postgres>>::type_info();
let _: bool = sqlx::types::Type::<Postgres>::compatible(&type_info);
Ok(())
}
/// Test AccountId SQLx serialization/deserialization
#[test]
fn test_account_id_sqlx() -> Result<(), Box<dyn std::error::Error>> {
let account_id = AccountId::new("ACC-001")?;
// Test that AccountId can be used in SQLx queries (compile-time check)
let type_info = <AccountId as sqlx::Type<Postgres>>::type_info();
let _: bool = sqlx::types::Type::<Postgres>::compatible(&type_info);
Ok(())
}
/// Test OrderSide SQLx serialization/deserialization
#[test]
fn test_order_side_sqlx() {
let buy_side = OrderSide::Buy;
let sell_side = OrderSide::Sell;
// Test that OrderSide can be used in SQLx queries (compile-time check)
let type_info = <OrderSide as sqlx::Type<Postgres>>::type_info();
let _: bool = sqlx::types::Type::<Postgres>::compatible(&type_info);
}
/// Test that transparent newtypes work with underlying PostgreSQL types
#[test]
fn test_transparent_type_mapping() {
// OrderId should map to BIGINT (i64/u64)
assert_eq!(
<OrderId as sqlx::Type<Postgres>>::type_info().name(),
"BIGINT"
);
// String-based types should map to TEXT
assert_eq!(
<TradeId as sqlx::Type<Postgres>>::type_info().name(),
"TEXT"
);
assert_eq!(
<AccountId as sqlx::Type<Postgres>>::type_info().name(),
"TEXT"
);
// OrderSide should map to TEXT
assert_eq!(
<OrderSide as sqlx::Type<Postgres>>::type_info().name(),
"TEXT"
);
}
}
*/