#[cfg(test)] mod tests { use comrak::ComrakOptions; use mdx_gen::{process_markdown, MarkdownError, MarkdownOptions}; #[test] fn test_markdown_error_access() { // Ensure that the MarkdownError enum is accessible and works let error = MarkdownError::ConversionError("Test error".to_string()); assert_eq!( format!("{}", error), "Failed to convert Markdown to HTML: Test error" ); } #[test] fn test_process_markdown_with_default_options() { let markdown = "# Heading\n\nThis is a **bold** text."; let options = MarkdownOptions::new().with_comrak_options({ let mut opts = ComrakOptions::default(); opts.extension.table = true; // Ensure table extension is disabled for default test opts }); let result = process_markdown(markdown, &options) .expect("Failed to process markdown"); assert!( result.contains("

Heading

"), "Heading was not processed correctly" ); assert!( result.contains("bold"), "Bold text was not processed correctly" ); } #[test] fn test_process_markdown_with_custom_blocks() { let markdown = r#"
This is a note.
"#; let options = MarkdownOptions::new() .with_custom_blocks(true) .with_comrak_options({ let mut opts = ComrakOptions::default(); opts.extension.table = true; opts }); let result = process_markdown(markdown, &options) .expect("Failed to process markdown with custom blocks"); assert!(result.contains(r#"