Skip to content

Commit

Permalink
basic unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
archiewood committed Jan 21, 2025
1 parent 70ec94c commit 9b79f1a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/lib/preprocess/src/add-blank-lines.spec.cjs
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);
});
});

0 comments on commit 9b79f1a

Please sign in to comment.