Skip to content

Commit

Permalink
Add mdx?no-dts testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Sep 19, 2022
1 parent 826b0a7 commit 26d7466
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/mdx/mdx.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { assertStringIncludes } from "https://deno.land/std@0.155.0/testing/asserts.ts";

import { compile } from "http://localhost:8080/@mdx-js/mdx@2.1.3?no-dts";

const md = `
export const Thing = () => <>World!</>
# Hello, <Thing />
\`\`\`js
console.log("Hello, World!")
\`\`\`
`;

Deno.test("mdx?no-dts", async () => {
const output = await compile(md, {
jsxImportSource: "https://esm.sh/react@18.2.0",
});
const code = output.toString();
assertStringIncludes(
code,
`import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "https://esm.sh/react@18.2.0/jsx-runtime";`,
);
assertStringIncludes(code, `"h1"`);
assertStringIncludes(code, `"code"`);
assertStringIncludes(code, `"pre"`);
assertStringIncludes(code, `className: "language-js"`);
});

0 comments on commit 26d7466

Please sign in to comment.