Skip to content
Snippets Groups Projects
Commit 3a5732ce authored by syuilo's avatar syuilo
Browse files

Add code block tests

parent 5e7f1742
No related branches found
No related tags found
No related merge requests found
......@@ -173,16 +173,19 @@ describe('FullParser', () => {
const output = [CODE_BLOCK('abc', null)];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('コードブロックには複数行のコードを入力できる', () => {
const input = '```\na\nb\nc\n```';
const output = [CODE_BLOCK('a\nb\nc', null)];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('コードブロックは言語を指定できる', () => {
const input = '```js\nconst a = 1;\n```';
const output = [CODE_BLOCK('const a = 1;', 'js')];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('ブロックの前後にあるテキストが正しく解釈される', () => {
const input = 'abc\n```\nconst abc = 1;\n```\n123';
const output = [
......@@ -192,6 +195,21 @@ describe('FullParser', () => {
];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('ignore internal marker', () => {
const input = '```\naaa```bbb\n```';
const output = [CODE_BLOCK('aaa```bbb', null)];
assert.deepStrictEqual(mfm.parse(input), output);
});
it('trim after line break', () => {
const input = '```\nfoo\n```\nbar';
const output = [
CODE_BLOCK('foo', null),
TEXT('bar'),
];
assert.deepStrictEqual(mfm.parse(input), output);
});
});
describe('mathBlock', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment