2017-01-31 03:11:01 +03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import { MdRenderer } from '../../lib/utils/md-renderer';
|
|
|
|
|
|
|
|
describe('Utils', () => {
|
|
|
|
describe('Markdown renderer', () => {
|
2017-02-02 21:44:29 +03:00
|
|
|
let mdRender: MdRenderer;
|
2017-01-31 03:11:01 +03:00
|
|
|
beforeEach(() => {
|
|
|
|
mdRender = new MdRenderer();
|
|
|
|
});
|
2017-02-02 21:44:29 +03:00
|
|
|
it('should return a level-1 heading even though only level-2 is present', () => {
|
2017-01-31 03:11:01 +03:00
|
|
|
mdRender.renderMd('## Sub Intro');
|
2017-02-02 21:44:29 +03:00
|
|
|
Object.keys(mdRender.headings).length.should.be.equal(1);
|
|
|
|
should.exist(mdRender.headings['sub-intro']);
|
2017-01-31 03:11:01 +03:00
|
|
|
});
|
2017-02-02 21:44:29 +03:00
|
|
|
it('should return a level-2 heading as a child of level-1', () => {
|
2017-01-31 03:11:01 +03:00
|
|
|
mdRender.renderMd('# Introduction \n ## Sub Intro');
|
2017-02-02 21:44:29 +03:00
|
|
|
Object.keys(mdRender.headings).length.should.be.equal(1);
|
|
|
|
should.exist(mdRender.headings['introduction']);
|
|
|
|
should.exist(mdRender.headings['introduction'].children);
|
|
|
|
Object.keys(mdRender.headings['introduction'].children).length.should.be.equal(1);
|
2017-01-31 03:11:01 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|