From d74ce20d3181cf19632957b1cfbf4a349b319d1c Mon Sep 17 00:00:00 2001 From: Andrii Bakanov Date: Fri, 3 Jan 2025 11:37:15 +0100 Subject: [PATCH 1/2] fix: LOAPI-15 added `.msg` and `.mpp` to unsupported filed extensions --- src/validations.test.ts | 36 +++++++++++++++++++++--------------- src/validations.ts | 2 ++ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/validations.test.ts b/src/validations.test.ts index 926b148..41947bf 100644 --- a/src/validations.test.ts +++ b/src/validations.test.ts @@ -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 + ${'image.docx'} + ${'image.pdf'} +`('should return true for supported filename $filename', ({filename}) => { + expect(canBeConvertedToPDF(filename)).toEqual(true); +}); + +it.each` + filename + ${'image.mpp'} + ${'image.msg'} + ${'image.jpg'} + ${'image.mp4'} + ${'image.mp3'} + ${'image.wav'} + ${'image.chm'} + ${'image.gdoc'} + ${'image.dwg'} +`('should return false for unsupported filename $filename', ({filename}) => { + expect(canBeConvertedToPDF(filename)).toEqual(false); }); diff --git a/src/validations.ts b/src/validations.ts index 2da7165..b8887d3 100644 --- a/src/validations.ts +++ b/src/validations.ts @@ -10,6 +10,8 @@ const UNSUPPORTED_FILE_EXTENSIONS = [ '.gslides', '.zip', '.dwg', + '.msg', + '.mpp', ]; export function canBeConvertedToPDF(filename: string): boolean { From a025ec5d9f2336f20d30c3a614428d5c354b38c8 Mon Sep 17 00:00:00 2001 From: Andrii Bakanov Date: Fri, 3 Jan 2025 11:55:25 +0100 Subject: [PATCH 2/2] test: LOAPI-15 adjusted file names --- src/validations.test.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/validations.test.ts b/src/validations.test.ts index 41947bf..c305104 100644 --- a/src/validations.test.ts +++ b/src/validations.test.ts @@ -2,23 +2,23 @@ import {canBeConvertedToPDF} from './validations'; it.each` filename - ${'image.docx'} - ${'image.pdf'} + ${'document.docx'} + ${'document.pdf'} `('should return true for supported filename $filename', ({filename}) => { expect(canBeConvertedToPDF(filename)).toEqual(true); }); it.each` filename - ${'image.mpp'} - ${'image.msg'} + ${'project.mpp'} + ${'email.msg'} ${'image.jpg'} - ${'image.mp4'} - ${'image.mp3'} - ${'image.wav'} - ${'image.chm'} - ${'image.gdoc'} - ${'image.dwg'} + ${'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); });