Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing unit tests in webParser.test.tsx #206

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/__tests__/webParser.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test('inline code', () => {
});

test('codeblock', () => {
expect('```\nHello world!\n```').toBeParsedAsHTML('<span class="syntax">```</span><span class="pre"><br>Hello world!<br></span><span class="syntax">```</span>');
expect('```\nHello world!\n```').toBeParsedAsHTML('<span class="syntax">```</span><span class="pre">\nHello world!\n</span><span class="syntax">```</span>');
});

describe('quote', () => {
Expand All @@ -174,19 +174,19 @@ describe('quote', () => {

test('multiple blockquotes', () => {
expect('> Hello\n> beautiful\n> world').toBeParsedAsHTML(
'<span class="blockquote"><span class="syntax">&gt;</span> Hello</span><br><span class="blockquote"><span class="syntax">&gt;</span> beautiful</span><br><span class="blockquote"><span class="syntax">&gt;</span> world</span>',
'<span class="blockquote"><span class="syntax">&gt;</span> Hello</span>\n<span class="blockquote"><span class="syntax">&gt;</span> beautiful</span>\n<span class="blockquote"><span class="syntax">&gt;</span> world</span>',
);
});

test('separate blockquotes', () => {
expect('> Lorem ipsum\ndolor\n> sit amet').toBeParsedAsHTML(
'<span class="blockquote"><span class="syntax">&gt;</span> Lorem ipsum</span><br>dolor<br><span class="blockquote"><span class="syntax">&gt;</span> sit amet</span>',
'<span class="blockquote"><span class="syntax">&gt;</span> Lorem ipsum</span>\ndolor\n<span class="blockquote"><span class="syntax">&gt;</span> sit amet</span>',
);
});

test('nested blockquotes', () => {
expect('>>>> Lorem ipsum dolor sit amet').toBeParsedAsHTML(
'<span class="blockquote"><span class="syntax">&gt;</span><span class="blockquote"><span class="syntax">&gt;</span><span class="blockquote"><span class="syntax">&gt;</span><span class="blockquote"><span class="syntax">&gt;</span> Lorem ipsum dolor sit amet</span></span></span></span>',
'<span class="blockquote"><span class="blockquote"><span class="blockquote"><span class="blockquote"><span class="syntax">&gt;</span><span class="syntax">&gt;</span><span class="syntax">&gt;</span><span class="syntax">&gt;</span> Lorem ipsum dolor sit amet</span></span></span></span>',
);
});

Expand Down Expand Up @@ -225,7 +225,7 @@ describe('trailing whitespace', () => {
});

test('newline', () => {
expect('> Hello world\n').toBeParsedAsHTML('<span class="blockquote"><span class="syntax">&gt;</span> Hello world</span><br>');
expect('> Hello world\n').toBeParsedAsHTML('<span class="blockquote"><span class="syntax">&gt;</span> Hello world</span>\n');
});
});

Expand All @@ -243,12 +243,12 @@ describe('trailing whitespace', () => {
});

test('newline', () => {
expect('# Hello world\n').toBeParsedAsHTML('<span class="syntax"># </span><span class="h1">Hello world</span><br>');
expect('# Hello world\n').toBeParsedAsHTML('<span class="syntax"># </span><span class="h1">Hello world</span>\n');
});

test('multiple quotes', () => {
expect('> # Hello\n> # world').toBeParsedAsHTML(
'<span class="blockquote"><span class="syntax">&gt;</span> <span class="syntax"># </span><span class="h1">Hello</span></span><br><span class="blockquote"><span class="syntax">&gt;</span> <span class="syntax"># </span><span class="h1">world</span></span>',
'<span class="blockquote"><span class="syntax">&gt;</span> <span class="syntax"># </span><span class="h1">Hello</span></span>\n<span class="blockquote"><span class="syntax">&gt;</span> <span class="syntax"># </span><span class="h1">world</span></span>',
);
});
});
Expand Down
Loading