#[cfg(test)] mod tests { use mdx_gen::extensions::{process_custom_blocks, process_tables}; use mdx_gen::{ColumnAlignment, CustomBlockType}; #[test] fn test_column_alignment() { assert_eq!(ColumnAlignment::Left, ColumnAlignment::Left); assert_eq!(ColumnAlignment::Center, ColumnAlignment::Center); assert_eq!(ColumnAlignment::Right, ColumnAlignment::Right); } #[test] fn test_custom_block_get_alert_class() { assert_eq!( CustomBlockType::Note.get_alert_class(), "alert-info" ); assert_eq!( CustomBlockType::Warning.get_alert_class(), "alert-warning" ); assert_eq!( CustomBlockType::Tip.get_alert_class(), "alert-success" ); assert_eq!( CustomBlockType::Info.get_alert_class(), "alert-primary" ); assert_eq!( CustomBlockType::Important.get_alert_class(), "alert-danger" ); assert_eq!( CustomBlockType::Caution.get_alert_class(), "alert-secondary" ); } #[test] fn test_custom_block_get_title() { assert_eq!(CustomBlockType::Note.get_title(), "Note"); assert_eq!(CustomBlockType::Warning.get_title(), "Warning"); assert_eq!(CustomBlockType::Tip.get_title(), "Tip"); assert_eq!(CustomBlockType::Info.get_title(), "Info"); assert_eq!(CustomBlockType::Important.get_title(), "Important"); assert_eq!(CustomBlockType::Caution.get_title(), "Caution"); } #[test] fn test_process_custom_blocks() { let input = r#"
This is a note.
This is a warning.
This is a tip.
This is an info block.
This is important.
This is a caution.
"#; let processed = process_custom_blocks(input); assert!(processed.contains(r#""#)); assert!(processed.contains(r#""#)); assert!(processed.contains(r#""#)); assert!(processed.contains(r#""#)); assert!(processed.contains(r#""#)); assert!(processed.contains(r#""#)); } #[test] fn test_process_tables() { let input = r#"
CenterRightLeft
"#; let processed = process_tables(input); assert!(processed.contains( r#"
"# )); assert!(processed.contains( r#""# )); assert!(processed.contains( r#""# )); assert!( processed.contains(r#""#) ); assert!(processed.contains("
CenterRightLeft
")); } }