import { describe, it, expect } from 'vitest'; import { BlogPost } from './BlogPost.js'; const exampleMarkdownWithFrontMatter = `--- title: "Test Blog Post" date: 2023-02-01T08:00:00Z slug: "2023-02-01-test" --- This is the content of the blog post. This is a [link](http://www.bbc.co.uk) - This is a list item - This is another list item `; describe('BlogPost', () => { it(`should construct`, () => { // GIVEN const blogPost = new BlogPost({ title: 'Test Title', markdownContent: 'Test Content' }); // THEN expect(blogPost.title).toBe('Test Title'); expect(blogPost.markdownContent).toBe('Test Content'); }); it(`Should parse markdown to HTML`, async () => { // GIVEN const blogPost = new BlogPost({ title: 'Test Title', markdownContent: exampleMarkdownWithFrontMatter }); // WHEN const html = await blogPost.getHtml(); // THEN expect(html).toStrictEqual( [ `

This is the content of the blog post.

`, `

This is a link

`, ``, ].join(`\n`) ); }); });