@@ -17,36 +17,40 @@ jest.setTimeout(timeouts.test);
17
17
test ( 'file upload should show thumbnail and file name' , async ( ) => {
18
18
const { driver, pageObjects } = await setupWebDriver ( {
19
19
props : {
20
- attachmentMiddleware : ( ) => next => ( {
21
- activity = { } ,
22
- activity : { from : { role } } = { } ,
23
- attachment,
24
- attachment : { contentType, thumbnailUrl } = { }
25
- } ) => {
26
- if ( role === 'user' && / ^ i m a g e \/ / u. test ( contentType ) && thumbnailUrl ) {
27
- const patchedAttachment = Object . assign ( { } , attachment , {
28
- contentType : 'application/octet-stream' ,
29
- thumbnailUrl : undefined
30
- } ) ;
20
+ attachmentMiddleware :
21
+ ( ) =>
22
+ next =>
23
+ ( {
24
+ activity = { } ,
25
+ activity : { from : { role } } = { } ,
26
+ attachment,
27
+ attachment : { contentType, thumbnailUrl } = { }
28
+ } ) => {
29
+ if ( role === 'user' && / ^ i m a g e \/ / u. test ( contentType ) && thumbnailUrl ) {
30
+ const patchedAttachment = Object . assign ( { } , attachment , {
31
+ contentType : 'application/octet-stream' ,
32
+ thumbnailUrl : undefined
33
+ } ) ;
31
34
32
- const patchedAttachments = activity . attachments . map ( target =>
33
- target === attachment ? patchedAttachment : target
34
- ) ;
35
+ const patchedAttachments = activity . attachments . map ( target =>
36
+ target === attachment ? patchedAttachment : target
37
+ ) ;
35
38
36
- const patchedActivity = Object . assign ( { } , activity , {
37
- attachments : patchedAttachments
38
- } ) ;
39
+ const patchedActivity = Object . assign ( { } , activity , {
40
+ attachments : patchedAttachments
41
+ } ) ;
39
42
40
- return React . createElement (
41
- React . Fragment ,
42
- { } ,
43
- next ( { activity, attachment } ) ,
44
- next ( { activity : patchedActivity , attachment : patchedAttachment } )
45
- ) ;
46
- }
43
+ return React . createElement (
44
+ React . Fragment ,
45
+ { } ,
46
+ next ( { activity, attachment } ) ,
47
+ next ( { activity : patchedActivity , attachment : patchedAttachment } )
48
+ ) ;
49
+ }
47
50
48
- return next ( { activity, attachment } ) ;
49
- }
51
+ return next ( { activity, attachment } ) ;
52
+ } ,
53
+ styleOptions : { sendAttachmentOn : 'attach' }
50
54
} ,
51
55
// TODO: [P3] Offline bot did not reply with a downloadable attachment, we need to use production bot
52
56
useProductionBot : true
0 commit comments