This commit is contained in:
Alan Grainger
2026-10-06 14:57:10 +13:00
parent 242d716f7b
commit 7a20c72f77
15 changed files with 225 additions and 19 deletions
+8
View File
@@ -27,6 +27,14 @@ describe('fileType', () => {
expect(fileType('IMG_0042.HEIC', 'image/heic')).toBe('image/heic')
})
it('derives a type from the extension when the browser gives a generic one', () => {
expect(fileType('IMG_0042.HEIC', 'application/octet-stream')).toBe('image/heic')
})
it('keeps a generic type it cannot improve on, so the client refuses the file', () => {
expect(fileType('notes.txt', 'application/octet-stream')).toBe('application/octet-stream')
})
it('derives a type from the extension when the browser gives none', () => {
expect(fileType('IMG_0042.HEIC', '')).toBe('image/heic')
expect(fileType('DSC_0001.NEF', '')).toBe('image/x-nikon-nef')