Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli committed Sep 14, 2023
1 parent 6e790fc commit 34160bc
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion packages/markdown/parseMarkdown.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { expect } from 'chai';
import { getContents, getDescription, getTitle, getHeaders, getCodeblock } from './parseMarkdown';
import {
getContents,
getDescription,
getTitle,
getHeaders,
getCodeblock,
renderMarkdown,
} from './parseMarkdown';

describe('parseMarkdown', () => {
describe('getTitle', () => {
Expand Down Expand Up @@ -234,4 +241,39 @@ authors:
});
});
});

describe('renderMarkdown', () => {
it('should render markdown lists correctly', () => {
expect(
renderMarkdown(
[
'The track presentation:',
'- `normal` the track will render a bar representing the slider value.',
'- `inverted` the track will render a bar representing the remaining slider value.',
'- `false` the track will render without a bar.',
].join('\n'),
),
).to.equal(
[
'<p>The track presentation:</p>',
'<ul>',
'<li><code>normal</code> the track will render a bar representing the slider value.</li>',
'<li><code>inverted</code> the track will render a bar representing the remaining slider value.</li>',
'<li><code>false</code> the track will render without a bar.</li>',
'</ul>',
'',
].join('\n'),
);
});

it('should render inline descriptions correctly', () => {
expect(
renderMarkdown(
'Allows to control whether the dropdown is open. This is a controlled counterpart of `defaultOpen`.',
),
).to.equal(
'Allows to control whether the dropdown is open. This is a controlled counterpart of <code>defaultOpen</code>.',
);
});
});
});

0 comments on commit 34160bc

Please sign in to comment.