2018-08-14 23:58:19 +03:00
|
|
|
import test from "ava";
|
|
|
|
import mdx from "@mdx-js/mdx";
|
|
|
|
import { transform } from "babel-core";
|
|
|
|
import env from "babel-preset-env";
|
|
|
|
import react from "babel-preset-react";
|
|
|
|
import stage0 from "babel-preset-stage-0";
|
|
|
|
|
|
|
|
import fmLoader from "../lib/mdx-fm-loader";
|
|
|
|
|
|
|
|
const content = `# A Heading
|
|
|
|
|
|
|
|
some other content`;
|
|
|
|
|
|
|
|
test("mdx-fm-loader", async t => {
|
|
|
|
const loader = fmLoader.bind({
|
|
|
|
async() {
|
|
|
|
return (err, result) => {
|
|
|
|
t.is(err, null, "mdx-fm-loader should not error");
|
2018-08-15 09:45:19 +03:00
|
|
|
t.notThrows(() => {
|
2018-08-14 23:58:19 +03:00
|
|
|
transform(mdx.sync(result), { presets: [env, react, stage0] });
|
|
|
|
}, SyntaxError);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const cb = await loader(content);
|
|
|
|
});
|