From 466502023527ebca2d62d5a1a5650becff53237b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Mon, 18 Nov 2024 09:33:44 +0100 Subject: [PATCH] Fix tests --- __tests__/ExpensiMark-HTML-test.js | 38 +++++++++++++----------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 67dabe84..24931b83 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -1125,13 +1125,13 @@ test('Test quotes markdown replacement and removing
from
 and  {
     const testString = '> \n>';
-    const resultString = '> 
>'; + const resultString = '
>'; expect(parser.replace(testString)).toBe(resultString); }); test('Test quotes markdown replacement with text starts with blank quote', () => { const testString = '> \ntest'; - const resultString = '>
test'; + const resultString = '
test'; expect(parser.replace(testString)).toBe(resultString); }); @@ -1143,7 +1143,7 @@ test('Test quotes markdown replacement with quotes starts with blank quote row', test('Test quotes markdown replacement with quotes ends with blank quote rows', () => { const testString = '> test\n> \n>'; - const resultString = '
test

'; + const resultString = '
test
>'; expect(parser.replace(testString)).toBe(resultString); }); @@ -1162,14 +1162,14 @@ test('Test quotes markdown replacement with quotes includes multiple middle blan test('Test quotes markdown replacement with text includes blank quotes', () => { const testString = '> \n> quote1 line a\n> quote1 line b\ntest\n> \ntest\n> quote2 line a\n> \n> \n> quote2 line b with an empty line above'; const resultString = - '

quote1 line a
quote1 line b
test
>
test
quote2 line a


quote2 line b with an empty line above
'; + '

quote1 line a
quote1 line b
test
test
quote2 line a


quote2 line b with an empty line above
'; expect(parser.replace(testString)).toBe(resultString); }); test('Test quotes markdown replacement with text includes multiple spaces', () => { - const quoteTestStartString = '> Indented\n>No indent\n> Indented \n> > Nested indented \n> Indented '; + const quoteTestStartString = '> Indented\n>No indent\n> Indented \n>> Nested indented \n> > Nested not indented \n> Indented '; const quoteTestReplacedString = - '
Indented
>No indent
Indented
Nested indented
Indented
'; + '
Indented
>No indent
Indented
Nested indented
> Nested not indented
Indented
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); @@ -1192,13 +1192,7 @@ test('Test markdown quotes without spaces after > should not be parsed', () => { test('Test markdown quotes without spaces after > should not be parsed', () => { const testString = '> > > test'; - const resultString = '
test
'; - expect(parser.replace(testString)).toBe(resultString); -}); - -test('Test markdown quotes without spaces after > should not be parsed', () => { - const testString = '>>> test'; - const resultString = '>>> test'; + const resultString = '
> > test
'; expect(parser.replace(testString)).toBe(resultString); }); @@ -2027,54 +2021,54 @@ test('Test italic/bold/strikethrough markdown to keep consistency', () => { describe('multi-level blockquote', () => { test('test max level of blockquote (3)', () => { - const quoteTestStartString = '> > > > > Hello world'; - const quoteTestReplacedString = '
> > Hello world
'; + const quoteTestStartString = '>>>>> Hello world'; + const quoteTestReplacedString = '
>> Hello world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multi-level blockquote with single space', () => { - const quoteTestStartString = '> > > Hello world'; + const quoteTestStartString = '>>> Hello world'; const quoteTestReplacedString = '
Hello world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multi-level blockquote with multiple spaces', () => { const quoteTestStartString = '> > > Hello world'; - const quoteTestReplacedString = '
Hello world
'; + const quoteTestReplacedString = '
> > Hello world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multi-level blockquote with mixed spaces', () => { const quoteTestStartString = '> > > Hello world'; - const quoteTestReplacedString = '
Hello world
'; + const quoteTestReplacedString = '
> > Hello world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multi-level blockquote with diffrent syntax', () => { - const quoteTestStartString = '> > _Hello_ *world*'; + const quoteTestStartString = '>> _Hello_ *world*'; const quoteTestReplacedString = '
Hello world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multi-level blockquote with nested heading', () => { - const quoteTestStartString = '> > # Hello world'; + const quoteTestStartString = '>> # Hello world'; const quoteTestReplacedString = '

Hello world

'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multiline multi-level blockquote', () => { - const quoteTestStartString = '> > Hello my\n> > beautiful\n> > world\n'; + const quoteTestStartString = '>> Hello my\n>> beautiful\n>> world\n'; const quoteTestReplacedString = '
Hello my
beautiful
world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString); }); test('multiline blockquote with diffrent levels', () => { - const quoteTestStartString = '> > > Hello my\n> > beautiful\n> world\n'; + const quoteTestStartString = '>>> Hello my\n>> beautiful\n> world\n'; const quoteTestReplacedString = '
Hello my
beautiful
world
'; expect(parser.replace(quoteTestStartString)).toBe(quoteTestReplacedString);