Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/test/suite/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ suite('Helpers Test Suite', () => {
});

suite('getHtmlForWebview', () => {
test('should handle empty input correctly', () => {
const html = getHtmlForWebview('');
assert.ok(html.includes('<body'), 'Should contain body tag');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better test precision, it's advisable to check for the complete opening tag <body>. The current check html.includes('<body') is a bit loose and could potentially pass even if the tag was malformed (e.g., <body-something>). Making the assertion more specific ensures the test is more robust against future regressions.

Suggested change
assert.ok(html.includes('<body'), 'Should contain body tag');
assert.ok(html.includes('<body>'), 'Should contain body tag');

assert.ok(html.includes('</body>'), 'Should contain closing body tag');
});

test('should convert basic Markdown to HTML', () => {
const markdown = '# Hello\n\nThis is **bold** text.';
const html = getHtmlForWebview(markdown);
Expand Down
Loading