feat: add MIME plumbing for markdown (.md) format
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ describe('outputMimeType', () => {
|
||||
expect(outputMimeType('docx')).toBe(
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
|
||||
);
|
||||
expect(outputMimeType('md')).toBe('text/markdown');
|
||||
});
|
||||
|
||||
it('throws for an unknown target format', () => {
|
||||
@@ -61,6 +62,17 @@ describe('resolveInputFormat', () => {
|
||||
await fs.unlink(fixturePath);
|
||||
});
|
||||
|
||||
it('trusts the declared format for undetectable md files', async () => {
|
||||
const fixturePath = path.join(import.meta.dirname, 'fixtures', 'sample.md');
|
||||
await fs.writeFile(fixturePath, '# plain markdown, no magic bytes');
|
||||
|
||||
const result = await resolveInputFormat(fixturePath, 'md');
|
||||
|
||||
expect(result).toEqual({ mime: 'text/markdown', valid: true });
|
||||
|
||||
await fs.unlink(fixturePath);
|
||||
});
|
||||
|
||||
it('rejects an undetectable file declared as a binary format', async () => {
|
||||
const fixturePath = path.join(import.meta.dirname, 'fixtures', 'sample-fake.png');
|
||||
await fs.writeFile(fixturePath, 'this is not really a PNG');
|
||||
|
||||
Reference in New Issue
Block a user