@@ -3,50 +3,18 @@ import { v4 as uuidv4 } from 'uuid';
33
44import { FastifyInstance } from 'fastify' ;
55
6- import { HttpMethod , ItemType , PermissionLevel , ResultOf } from '@graasp/sdk' ;
6+ import { HttpMethod , ItemType , PermissionLevel } from '@graasp/sdk' ;
77
88import build , { clearDatabase , mockAuthenticate , unmockAuthenticate } from '../../../test/app' ;
99import { seedFromJson } from '../../../test/mocks/seed' ;
1010import { db } from '../../drizzle/db' ;
11- import { ItemMembershipRaw , ItemVisibilityRaw } from '../../drizzle/types' ;
12- import { MinimalMember } from '../../types' ;
1311import { assertIsDefined } from '../../utils/assertions' ;
1412import { ItemNotFound , MemberCannotAccess } from '../../utils/errors' ;
1513import { assertIsMemberForTest } from '../authentication' ;
1614import { ItemWrapper , PackedItem } from './ItemWrapper' ;
1715import { expectManyPackedItems , expectPackedItem , expectThumbnails } from './test/fixtures/items' ;
1816import { Ordering , SortBy } from './types' ;
1917
20- /**
21- *
22- * @param resultItems ResultOf items
23- * @param correctItems
24- * @param itemMemberships we suppose item memberships is ordered in the same order as correctItems
25- * @param creator
26- * @param itemVisibilities
27- */
28- const expectResultOfPackedItems = (
29- resultItems : ResultOf < PackedItem > ,
30- correctItems ,
31- itemMemberships ?: ItemMembershipRaw [ ] ,
32- creator ?: MinimalMember ,
33- itemVisibilities ?: ItemVisibilityRaw [ ] ,
34- ) => {
35- correctItems . forEach ( ( { id, path } ) => {
36- const idx = correctItems . findIndex ( ( { id : thisId } ) => thisId === id ) ;
37- const item = resultItems [ id ] ;
38- expectPackedItem (
39- item ,
40- new ItemWrapper (
41- { ...correctItems [ idx ] , creator } ,
42- itemMemberships ?. [ idx ] ,
43- itemVisibilities ?. filter ( ( iv ) => path . includes ( iv . itemPath ) ) ,
44- ) . packed ( ) ,
45- creator ,
46- ) ;
47- } ) ;
48- } ;
49-
5018// Mock S3 libraries
5119const deleteObjectMock = jest . fn ( async ( ) => console . debug ( 'deleteObjectMock' ) ) ;
5220const copyObjectMock = jest . fn ( async ( ) => console . debug ( 'copyObjectMock' ) ) ;
0 commit comments