Skip to content

Commit

Permalink
test: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Mar 27, 2024
1 parent 019c58f commit f9d2c70
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IMdTransformerResult } from '../..';

export default (ret: IMdTransformerResult) => {
expect(ret.content).toEqual(
'<><div className="markdown"><h3 id="codegroup"><a aria-hidden="true" tabIndex="-1" href="#codegroup"><span className="icon icon-link" /></a>{"CodeGroup"}</h3></div><CodeGroup><SourceCode title="npm" lang="bash">{$$contentTexts[0].value}</SourceCode><SourceCode title="yarn" lang="bash">{$$contentTexts[1].value}</SourceCode><SourceCode title="pnpm" lang="bash">{$$contentTexts[2].value}</SourceCode><SourceCode title=".dumirc.ts" lang="ts">{$$contentTexts[3].value}</SourceCode></CodeGroup></>',
);
};
25 changes: 25 additions & 0 deletions src/loaders/markdown/transformer/fixtures/code-group/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### CodeGroup

:::code-group

```bash [npm]
npm install -D dumi
```

```bash [yarn]
yarn add -D dumi
```

```bash [pnpm]
pnpm add -D dumi
```

```ts [.dumirc.ts]
import { defineConfig } from 'dumi';

export default defineConfig({
// ...
});
```

:::

0 comments on commit f9d2c70

Please sign in to comment.