aboutsummaryrefslogtreecommitdiffstats
path: root/tests/xxx_mdx_plugin_recma_document.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-11 16:27:38 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-11 16:27:38 +0200
commite484d1ecc5e405259767c0fd84072226fee40b71 (patch)
tree71d2a2f67870052aa026d0087dfb06cb96c40e17 /tests/xxx_mdx_plugin_recma_document.rs
parent73d8609565b808ac73df5ac34e6d4f7f23c25ad6 (diff)
downloadmarkdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.tar.gz
markdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.tar.bz2
markdown-rs-e484d1ecc5e405259767c0fd84072226fee40b71.zip
Refactor test utilities to improve names
Diffstat (limited to '')
-rw-r--r--tests/xxx_mdx_plugin_recma_document.rs (renamed from tests/xxx_document.rs)14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/xxx_document.rs b/tests/xxx_mdx_plugin_recma_document.rs
index 7e43b1c..1cb91fe 100644
--- a/tests/xxx_document.rs
+++ b/tests/xxx_mdx_plugin_recma_document.rs
@@ -6,10 +6,10 @@ mod test_utils;
use micromark::{micromark_to_mdast, Constructs, Location, ParseOptions};
use pretty_assertions::assert_eq;
use test_utils::{
+ hast_util_to_swc::hast_util_to_swc,
+ mdast_util_to_hast::mdast_util_to_hast,
+ mdx_plugin_recma_document::{mdx_plugin_recma_document, Options as DocumentOptions},
swc::{parse_esm, parse_expression, serialize},
- to_document::{to_document, Options as DocumentOptions},
- to_hast::to_hast,
- to_swc::to_swc,
};
fn from_markdown(value: &str) -> Result<String, String> {
@@ -23,15 +23,15 @@ fn from_markdown(value: &str) -> Result<String, String> {
..ParseOptions::default()
},
)?;
- let hast = to_hast(&mdast);
- let swc_tree = to_swc(&hast, None, Some(&location))?;
- let program = to_document(swc_tree, &DocumentOptions::default(), Some(&location))?;
+ let hast = mdast_util_to_hast(&mdast);
+ let program = hast_util_to_swc(&hast, None, Some(&location))?;
+ let program = mdx_plugin_recma_document(program, &DocumentOptions::default(), Some(&location))?;
let value = serialize(&program.module);
Ok(value)
}
#[test]
-fn document() -> Result<(), String> {
+fn mdx_plugin_recma_document_test() -> Result<(), String> {
assert_eq!(
from_markdown("# hi\n\nAlpha *bravo* **charlie**.")?,
"function _createMdxContent(props) {