Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
added invalid html tests
rafaelsideguidec5e1d77a8253
diff --git a/apps/api/src/lib/__tests__/html-to-markdown.test.ts b/apps/api/src/lib/__tests__/html-to-markdown.test.tsindex 00db77588..3c68c959c 100644--- a/apps/api/src/lib/__tests__/html-to-markdown.test.ts+++ b/apps/api/src/lib/__tests__/html-to-markdown.test.ts@@ -25,5 +25,16 @@ describe('parseMarkdown', () => {await expect(parseMarkdown(html)).resolves.toBe(expectedMarkdown);});-+ it('should handle various types of invalid HTML gracefully', async () => {+ const invalidHtmls = [+ { html: '<html><p>Unclosed tag', expected: 'Unclosed tag' },+ { html: '<div><span>Missing closing div', expected: 'Missing closing div' },+ { html: '<p><strong>Wrong nesting</em></strong></p>', expected: '**Wrong nesting**' },+ { html: '<a href="http://example.com">Link without closing tag', expected: '[Link without closing tag](http://example.com)' }+ ];++ for (const { html, expected } of invalidHtmls) {+ await expect(parseMarkdown(html)).resolves.toBe(expected);+ }+ });});diff --git a/apps/api/src/lib/html-to-markdown.ts b/apps/api/src/lib/html-to-markdown.tsindex a5f699621..103948f49 100644--- a/apps/api/src/lib/html-to-markdown.ts+++ b/apps/api/src/lib/html-to-markdown.ts@@ -8,7 +8,6 @@ import dotenv from 'dotenv';import { Logger } from './logger';dotenv.config();-// TODO: test with invalid html// TODO: create a singleton for the converter// TODO: add a timeout to the Go parser