import { snakeCase } from 'lodash';
import { CollectionResource, defaultCollectionSelectedFields } from 'models/collection';
import { AuthService } from '../auth-service/auth-service';
-import { CollectionService, emptyCollectionUuid } from './collection-service';
+import { CollectionService, emptyCollectionPdh } from './collection-service';
describe('collection-service', () => {
let collectionService: CollectionService;
);
});
- it('should remove files with uuid prefix', async () => {
- // given
- serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
- const filePaths: string[] = ['/root/1'];
- const collectionUUID = 'zzzzz-tpzed-5o5tg0l9a57gxxx';
-
- // when
- await collectionService.deleteFiles(collectionUUID, filePaths);
-
- // then
- expect(serverApi.put).toHaveBeenCalledTimes(1);
- expect(serverApi.put).toHaveBeenCalledWith(
- `/collections/${collectionUUID}`, {
- collection: {
- preserve_version: true
- },
- replace_files: {
- '/root/1': '',
- },
- }
- );
- });
-
it('should batch remove files', async () => {
serverApi.put = jest.fn(() => Promise.resolve({ data: {} }));
// given
preserve_version: true
},
replace_files: {
- ["/" + directoryNames[i].out]: emptyCollectionUuid,
+ ["/" + directoryNames[i].out]: emptyCollectionPdh,
},
}
);