mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 11:42:24 +08:00
added invalid html tests
This commit is contained in:
parent
d60fa6e084
commit
c5e1d77a82
|
@ -25,5 +25,16 @@ describe('parseMarkdown', () => {
|
||||||
await expect(parseMarkdown(html)).resolves.toBe(expectedMarkdown);
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,6 @@ import dotenv from 'dotenv';
|
||||||
import { Logger } from './logger';
|
import { Logger } from './logger';
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
// TODO: test with invalid html
|
|
||||||
// TODO: create a singleton for the converter
|
// TODO: create a singleton for the converter
|
||||||
// TODO: add a timeout to the Go parser
|
// TODO: add a timeout to the Go parser
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user