@@ -354,20 +354,27 @@ describe('AttachmentService', () => {
354354 service . addAttachment ( customAttachment ) ;
355355
356356 expect ( service . mapToAttachments ( ) ) . toEqual ( [
357- { fallback : 'flower.png' , image_url : 'http://url/to/img' , type : 'image' } ,
357+ {
358+ fallback : 'flower.png' ,
359+ image_url : 'http://url/to/img' ,
360+ type : 'image' ,
361+ mime_type : 'image/png' ,
362+ } ,
358363 {
359364 type : 'video' ,
360365 title : 'test.mp4' ,
361366 file_size : 22233332 ,
362367 asset_url : 'http://url/to/file' ,
363368 thumb_url : 'http://url/to/thumb' ,
369+ mime_type : 'video/mp4' ,
364370 } ,
365371 {
366372 title : 'note.txt' ,
367373 file_size : 3272969 ,
368374 asset_url : 'http://url/to/data' ,
369375 type : 'file' ,
370376 thumb_url : undefined ,
377+ mime_type : 'plain/text' ,
371378 } ,
372379 {
373380 type : 'video' ,
@@ -380,31 +387,47 @@ describe('AttachmentService', () => {
380387
381388 it ( 'should create attachmentUploads from attachments' , ( ) => {
382389 const attachments = [
383- { fallback : 'flower.png' , image_url : 'http://url/to/img' , type : 'image' } ,
390+ {
391+ fallback : 'flower.png' ,
392+ image_url : 'http://url/to/img' ,
393+ type : 'image' ,
394+ mime_type : undefined ,
395+ } ,
384396 {
385397 title : 'note.txt' ,
386398 file_size : 3272969 ,
387399 asset_url : 'http://url/to/data' ,
388400 type : 'file' ,
401+ mime_type : undefined ,
389402 } ,
390403 {
391404 title : 'cute.mov' ,
392405 file_size : 45367543 ,
393406 asset_url : 'http://url/to/video' ,
394407 type : 'video' ,
395408 thumb_url : 'http://url/to/poster' ,
409+ mime_type : 'video/mov' ,
396410 } ,
397411 {
398412 type : 'file' ,
399413 asset_url : 'url/to/my/file' ,
400414 title : 'my-file.pdf' ,
415+ mime_type : 'application/pdf' ,
401416 isCustomAttachment : true ,
402417 } ,
403418 ] ;
404- const imageFile = { name : 'flower.png' } ;
405- const dataFile = { name : 'note.txt' , size : 3272969 } ;
406- const videoFile = { name : 'cute.mov' , size : 45367543 } ;
407- const customFile = { name : 'my-file.pdf' , size : undefined } ;
419+ const imageFile = { name : 'flower.png' , type : undefined } ;
420+ const dataFile = { name : 'note.txt' , size : 3272969 , type : undefined } ;
421+ const videoFile = {
422+ name : 'cute.mov' ,
423+ size : 45367543 ,
424+ type : 'video/mov' ,
425+ } ;
426+ const customFile = {
427+ name : 'my-file.pdf' ,
428+ size : undefined ,
429+ type : 'application/pdf' ,
430+ } ;
408431 const result = [
409432 {
410433 file : imageFile ,
@@ -462,6 +485,7 @@ describe('AttachmentService', () => {
462485 asset_url : 'url/to/my/file' ,
463486 file_size : undefined ,
464487 title : 'my-file.pdf' ,
488+ mime_type : undefined ,
465489 } ;
466490
467491 const spy = jasmine . createSpy ( ) ;
@@ -476,6 +500,7 @@ describe('AttachmentService', () => {
476500 file : {
477501 name : 'my-file.pdf' ,
478502 size : undefined ,
503+ type : undefined ,
479504 } as unknown as File ,
480505 type : 'file' ,
481506 fromAttachment : { ...customAttachment , isCustomAttachment : true } ,
0 commit comments