aboutsummaryrefslogtreecommitdiffstats
path: root/tests/xxx_jsx_rewrite.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_jsx_rewrite.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_jsx_rewrite.rs (renamed from tests/xxx_jsx_rewrite.rs)18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/xxx_jsx_rewrite.rs b/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs
index c383f13..497155f 100644
--- a/tests/xxx_jsx_rewrite.rs
+++ b/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs
@@ -6,11 +6,11 @@ mod test_utils;
use micromark::{micromark_to_mdast, Constructs, Location, ParseOptions};
use pretty_assertions::assert_eq;
use test_utils::{
- jsx_rewrite::{jsx_rewrite, Options as RewriteOptions},
+ 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},
+ mdx_plugin_recma_jsx_rewrite::{mdx_plugin_recma_jsx_rewrite, Options as RewriteOptions},
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, options: &RewriteOptions) -> Result<String, String> {
@@ -24,16 +24,16 @@ fn from_markdown(value: &str, options: &RewriteOptions) -> Result<String, String
..ParseOptions::default()
},
)?;
- let hast = to_hast(&mdast);
- let swc_tree = to_swc(&hast, Some("example.mdx".into()), Some(&location))?;
- let program = to_document(swc_tree, &DocumentOptions::default(), Some(&location))?;
- let program = jsx_rewrite(program, options, Some(&location));
+ let hast = mdast_util_to_hast(&mdast);
+ let program = hast_util_to_swc(&hast, Some("example.mdx".into()), Some(&location))?;
+ let program = mdx_plugin_recma_document(program, &DocumentOptions::default(), Some(&location))?;
+ let program = mdx_plugin_recma_jsx_rewrite(program, options, Some(&location));
let value = serialize(&program.module);
Ok(value)
}
#[test]
-fn rewrite() -> Result<(), String> {
+fn mdx_plugin_recma_jsx_rewrite_test() -> Result<(), String> {
assert_eq!(
from_markdown("", &Default::default())?,
"function _createMdxContent(props) {