mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2024-05-18 16:28:22 +00:00
a4ee38540d
We bundle markdown-it-kroki, which can add mermaid diagrams to marp slides using https://kroki.io.
49 lines
2.3 KiB
JavaScript
49 lines
2.3 KiB
JavaScript
const expect = require('chai').expect;
|
|
const { MarkdownItKrokiCore } = require('../../lib/plugin-core');
|
|
|
|
describe('# [unit-test] plugin-core.js', () => {
|
|
describe('## static method: readLanguageAndAltText() - language', () => {
|
|
[
|
|
{ test: null, expected: '' },
|
|
{ test: undefined, expected: '' },
|
|
{ test: '', expected: '' },
|
|
{ test: ' ', expected: '' },
|
|
{ test: 'plantuml', expected: 'plantuml' },
|
|
{ test: ' plantuml', expected: 'plantuml' },
|
|
{ test: 'plantuml ', expected: 'plantuml' },
|
|
{ test: 'plantuml +++', expected: 'plantuml' },
|
|
{ test: 'html+md', expected: 'html+md' },
|
|
{ test: 'graphviz[]', expected: 'graphviz' },
|
|
{ test: 'graphviz[test]', expected: 'graphviz' },
|
|
{ test: 'graphviz [test test]', expected: 'graphviz' },
|
|
].forEach(testCase => {
|
|
it(`### Can read diagramLanguage. in case \'${testCase.test}\'`, () => {
|
|
const actual = MarkdownItKrokiCore.readLanguageAndAltText(testCase.test);
|
|
const expected = testCase.expected;
|
|
expect(actual.language).to.be.equal(expected);
|
|
})
|
|
});
|
|
});
|
|
describe('## static method: readLanguageAndAltText() - alt', () => {
|
|
[
|
|
{ test: null, expected: '' },
|
|
{ test: undefined, expected: '' },
|
|
{ test: '', expected: '' },
|
|
{ test: ' ', expected: '' },
|
|
{ test: 'plantuml', expected: '' },
|
|
{ test: ' plantuml', expected: '' },
|
|
{ test: 'plantuml ', expected: '' },
|
|
{ test: 'plantuml +++', expected: '' },
|
|
{ test: 'html+md', expected: '' },
|
|
{ test: 'graphviz[]', expected: '' },
|
|
{ test: 'graphviz[test]', expected: 'test' },
|
|
{ test: 'graphviz [test test]', expected: 'test test' },
|
|
].forEach(testCase => {
|
|
it(`### Can read diagramLanguage. in case \'${testCase.test}\'`, () => {
|
|
const actual = MarkdownItKrokiCore.readLanguageAndAltText(testCase.test);
|
|
const expected = testCase.expected;
|
|
expect(actual.alt).to.be.equal(expected);
|
|
})
|
|
});
|
|
});
|
|
}); |