Skip to content

Commit

Permalink
merge and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaMachina committed Nov 20, 2024
1 parent 3f74892 commit 7dcb590
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 109 deletions.
38 changes: 22 additions & 16 deletions packages/remark-mermaid/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ A
const rawJs = await compileMdx(doc);
expect(rawJs.slice(rawJs.indexOf('function _createMdxContent'), rawJs.indexOf('return {') - 1))
.toMatchInlineSnapshot(`
"function _createMdxContent(props) {
const {Mermaid} = props.components || ({});
if (!Mermaid) _missingMdxReference("Mermaid", true);
return _jsx(Mermaid, {
chart: "graph TD\\\\nA"
});
}"
`);
"function _createMdxContent(props) {
const {Mermaid} = {
..._provideComponents(),
...props.components
};
if (!Mermaid) _missingMdxReference("Mermaid", true);
return _jsx(Mermaid, {
chart: "graph TD\\\\nA"
});
}"
`);
});
it('should escape', async () => {
const doc = `\`\`\`mermaid
Expand All @@ -30,13 +33,16 @@ Z["API"]
const rawJs = await compileMdx(doc);
expect(rawJs.slice(rawJs.indexOf('function _createMdxContent'), rawJs.indexOf('return {') - 1))
.toMatchInlineSnapshot(`
"function _createMdxContent(props) {
const {Mermaid} = props.components || ({});
if (!Mermaid) _missingMdxReference("Mermaid", true);
return _jsx(Mermaid, {
chart: "graph TD\\\\nZ[\\"API\\"]\\\\n\\\\\\\\n\`"
});
}"
`);
"function _createMdxContent(props) {
const {Mermaid} = {
..._provideComponents(),
...props.components
};
if (!Mermaid) _missingMdxReference("Mermaid", true);
return _jsx(Mermaid, {
chart: "graph TD\\\\nZ[\\"API\\"]\\\\n\\\\\\\\n\`"
});
}"
`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
exports[`remark-npm2yarn > should convert to tabs 1`] = `
""use strict";
const {jsx: _jsx, jsxs: _jsxs} = arguments[0];
const title = "";
const {useMDXComponents: _provideComponents} = arguments[0];
const metadata = {};
function useTOC(props) {
return [];
}
const toc = useTOC();
function _createMdxContent(props) {
const _components = {
code: "code",
pre: "pre",
span: "span",
..._provideComponents(),
...props.components
}, {$Tabs} = _components;
if (!$Tabs) _missingMdxReference("$Tabs", true);
Expand Down Expand Up @@ -172,9 +174,8 @@ function _createMdxContent(props) {
});
}
return {
title,
metadata,
useTOC,
toc,
default: _createMdxContent
};
function _missingMdxReference(id, component) {
Expand Down
Loading

0 comments on commit 7dcb590

Please sign in to comment.