Skip to content

Commit

Permalink
test(preset): add header case for remark
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Apr 7, 2020
1 parent b44f0b0 commit 2b5bc7c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# H1

## H2

### H3 with <Badge>I will be ignored</Badge>
25 changes: 25 additions & 0 deletions packages/preset-dumi/src/transformer/test/remark-header.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import fs from 'fs';
import path from 'path';
import remark from '../remark';

describe('basic example', () => {
const FILE_PATH = path.join(__dirname, '../fixtures/raw/remark-header.md');

it('transform md to jsx', () => {
const result = remark(fs.readFileSync(FILE_PATH).toString(), {
fileAbsPath: FILE_PATH,
strategy: 'default',
previewLangs: [],
});

expect(result.data.slugs).toEqual([
{ depth: 1, value: 'H1', heading: 'h1' },
{ depth: 2, value: 'H2', heading: 'h2' },
{
depth: 3,
value: 'H3 with ',
heading: 'h3-with-i-will-be-ignored',
},
]);
});
});

0 comments on commit 2b5bc7c

Please sign in to comment.