@@ -419,10 +419,12 @@ describe('Attachments', () => {
419419 } ) ;
420420
421421 describe ( 'List attachments' , ( ) => {
422- let mars ;
422+ let mars , attIds ;
423423 before ( async ( ) => {
424424 mars = await createTestUser ( 'mars' ) ;
425425
426+ attIds = [ ] ;
427+
426428 for ( let i = 0 ; i < 10 ; i ++ ) {
427429 const data = new FormData ( ) ;
428430 data . append (
@@ -431,7 +433,8 @@ describe('Attachments', () => {
431433 `test${ i + 1 } .txt` ,
432434 ) ;
433435 // eslint-disable-next-line no-await-in-loop
434- await performJSONRequest ( 'POST' , '/v1/attachments' , data , authHeaders ( mars ) ) ;
436+ const resp = await performJSONRequest ( 'POST' , '/v1/attachments' , data , authHeaders ( mars ) ) ;
437+ attIds . push ( resp . attachments . id ) ;
435438 }
436439 } ) ;
437440
@@ -474,6 +477,27 @@ describe('Attachments', () => {
474477 }
475478 } ) ;
476479
480+ it ( `should get Mars'es attachments by ids` , async ( ) => {
481+ const otherId = '00000000-0000-4000-8000-000000000001' ;
482+ const ids = [ ...attIds . slice ( 0 , 4 ) , otherId ] ;
483+ const resp = await performJSONRequest (
484+ 'POST' ,
485+ '/v2/attachments/byIds' ,
486+ { ids } ,
487+ authHeaders ( mars ) ,
488+ ) ;
489+ expect ( resp , 'to satisfy' , {
490+ attachments : [
491+ { fileName : 'test1.txt' } ,
492+ { fileName : 'test2.txt' } ,
493+ { fileName : 'test3.txt' } ,
494+ { fileName : 'test4.txt' } ,
495+ ] ,
496+ users : [ { id : mars . user . id } ] ,
497+ idsNotFound : [ otherId ] ,
498+ } ) ;
499+ } ) ;
500+
477501 it ( `should list the rest of Mars'es attachments` , async ( ) => {
478502 const resp = await performJSONRequest (
479503 'GET' ,
0 commit comments