Skip to content

Commit

Permalink
kp: tests (#910)
Browse files Browse the repository at this point in the history
| [![PR App][icn]][demo] | Fix RM-XYZ |
| :--------------------: | :--------: |

## 🧰 Changes

Describe your changes in detail.

## 🧬 QA & Testing

- [Broken on production][prod].
- [Working in this PR app][demo].

[demo]: https://markdown-pr-PR_NUMBER.herokuapp.com
[prod]: https://SUBDOMAIN.readme.io
[icn]:
https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg
  • Loading branch information
kellyjosephprice committed Jun 18, 2024
1 parent 35c38e3 commit df6f7c3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions __tests__/compilers/html-block.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { mdast, mdx } from '../../index';

describe('html-block compiler', () => {
it('compiles html blocks within containers', () => {
const markdown = `
> 🚧 It compiles!
>
> <HTMLBlock>{\`
> <strong style="color: olive">Hello, World!</strong>
> \`}</HTMLBlock>
`;

expect(mdx(mdast(markdown)).trim()).toBe(markdown.trim());
});

it('compiles html blocks with indents', () => {
const markdown = `
<HTMLBlock>{\`
<pre><code>
const foo = () => {
const bar = {
baz: 'blammo'
}
return bar
}
</code></pre>
\`}</HTMLBlock>
`;

expect(mdx(mdast(markdown)).trim()).toBe(markdown.trim());

Check failure on line 31 in __tests__/compilers/html-block.test.ts

View workflow job for this annotation

GitHub Actions / Test (lts/-1, 16)

__tests__/compilers/html-block.test.ts > html-block compiler > compiles html blocks with indents

AssertionError: expected '<HTMLBlock>{`\n <pre><code>\n const…' to be '<HTMLBlock>{`\n <pre><code>\nconst f…' // Object.is equality - Expected + Received <HTMLBlock>{` <pre><code> - const foo = () => { + const foo = () => { const bar = { baz: 'blammo' } - - return bar - } + return bar + } </code></pre> `}</HTMLBlock> ❯ __tests__/compilers/html-block.test.ts:31:41

Check failure on line 31 in __tests__/compilers/html-block.test.ts

View workflow job for this annotation

GitHub Actions / Test (lts/-1, 17)

__tests__/compilers/html-block.test.ts > html-block compiler > compiles html blocks with indents

AssertionError: expected '<HTMLBlock>{`\n <pre><code>\n const…' to be '<HTMLBlock>{`\n <pre><code>\nconst f…' // Object.is equality - Expected + Received <HTMLBlock>{` <pre><code> - const foo = () => { + const foo = () => { const bar = { baz: 'blammo' } - - return bar - } + return bar + } </code></pre> `}</HTMLBlock> ❯ __tests__/compilers/html-block.test.ts:31:41

Check failure on line 31 in __tests__/compilers/html-block.test.ts

View workflow job for this annotation

GitHub Actions / Test (lts/-1, 18)

__tests__/compilers/html-block.test.ts > html-block compiler > compiles html blocks with indents

AssertionError: expected '<HTMLBlock>{`\n <pre><code>\n const…' to be '<HTMLBlock>{`\n <pre><code>\nconst f…' // Object.is equality - Expected + Received <HTMLBlock>{` <pre><code> - const foo = () => { + const foo = () => { const bar = { baz: 'blammo' } - - return bar - } + return bar + } </code></pre> `}</HTMLBlock> ❯ __tests__/compilers/html-block.test.ts:31:41
});
});

0 comments on commit df6f7c3

Please sign in to comment.