-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70ec94c
commit 9b79f1a
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import addBlankLines from '../src/add-blank-lines.cjs'; | ||
|
||
describe('addBlankLines Preprocessor', () => { | ||
it('should not add blank lines to standard markdown', () => { | ||
const input = `# Hello, world! | ||
This is a test.`; | ||
const expectedOutput = `# Hello, world! | ||
This is a test.`; | ||
|
||
const result = addBlankLines.markup({ content: input, filename: 'test.md' }); | ||
|
||
expect(result.code).toBe(expectedOutput); | ||
}); | ||
|
||
it('should add blank lines before and after each block content', () => { | ||
const input = `# Hello, world! | ||
This is a test. | ||
\`\`\`sql orders | ||
SELECT * FROM orders | ||
\`\`\` | ||
{#each orders as order} | ||
1. {order.name} | ||
{/each} | ||
`; | ||
const expectedOutput = `# Hello, world! | ||
This is a test. | ||
\`\`\`sql orders | ||
SELECT * FROM orders | ||
\`\`\` | ||
{#each orders as order} | ||
1. {order.name} | ||
{/each} | ||
`; | ||
|
||
const result = addBlankLines.markup({ content: input, filename: 'test.md' }); | ||
|
||
console.log(input); | ||
console.log(result.code); | ||
|
||
expect(result.code).toBe(expectedOutput); | ||
}); | ||
}); |