Skip to content

Commit

Permalink
Merge pull request #329 from shelfio/feature/LOAPI-15-blacklist-msg-a…
Browse files Browse the repository at this point in the history
…nd-mpp

LOAPI-15 Added `.msg` and `.mpp` to unsupported filed extensions
  • Loading branch information
DrewsAbuse authored Jan 3, 2025
2 parents 8a584f8 + a025ec5 commit db9d495
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
36 changes: 21 additions & 15 deletions src/validations.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import {canBeConvertedToPDF} from './validations';

describe('canBeConvertedToPDF', () => {
it.each`
filename | expected
${'image.jpg'} | ${false}
${'image.mp4'} | ${false}
${'image.mp3'} | ${false}
${'image.wav'} | ${false}
${'image.chm'} | ${false}
${'image.gdoc'} | ${false}
${'image.dwg'} | ${false}
${'image.docx'} | ${true}
${'image.pdf'} | ${true}
`('should return $expected for filename $filename', ({filename, expected}) => {
expect(canBeConvertedToPDF(filename)).toEqual(expected);
});
it.each`
filename
${'document.docx'}
${'document.pdf'}
`('should return true for supported filename $filename', ({filename}) => {
expect(canBeConvertedToPDF(filename)).toEqual(true);
});

it.each`
filename
${'project.mpp'}
${'email.msg'}
${'image.jpg'}
${'video.mp4'}
${'audio.mp3'}
${'sound.wav'}
${'help.chm'}
${'google-doc.gdoc'}
${'drawing.dwg'}
`('should return false for unsupported filename $filename', ({filename}) => {
expect(canBeConvertedToPDF(filename)).toEqual(false);
});
2 changes: 2 additions & 0 deletions src/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const UNSUPPORTED_FILE_EXTENSIONS = [
'.gslides',
'.zip',
'.dwg',
'.msg',
'.mpp',
];

export function canBeConvertedToPDF(filename: string): boolean {
Expand Down

0 comments on commit db9d495

Please sign in to comment.