diff --git a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts index bb95a9c54..e61cb4ef7 100644 --- a/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts +++ b/src-ui/src/app/components/document-list/bulk-editor/bulk-editor.component.spec.ts @@ -802,30 +802,37 @@ describe('BulkEditorComponent', () => { .spyOn(documentListViewService, 'documents', 'get') .mockReturnValue([{ id: 3 }, { id: 4 }]) jest - .spyOn(documentListViewService, 'selected', 'get') - .mockReturnValue(new Set([3, 4])) + .spyOn(documentListViewService, 'getSelectedInOrder') + .mockReturnValue(new Array(3, 4)) jest .spyOn(permissionsService, 'currentUserHasObjectPermissions') .mockReturnValue(true) + component.downloadForm.get('downloadAsSingleFile').patchValue(false) component.downloadForm.get('downloadFileTypeArchive').patchValue(true) fixture.detectChanges() let downloadSpy = jest.spyOn(documentService, 'bulkDownload') //archive component.downloadSelected() - expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'archive', false) + expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'archive', false, false) //originals component.downloadForm.get('downloadFileTypeArchive').patchValue(false) component.downloadForm.get('downloadFileTypeOriginals').patchValue(true) component.downloadSelected() - expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'originals', false) + expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'originals', false, false) //both component.downloadForm.get('downloadFileTypeArchive').patchValue(true) component.downloadSelected() - expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'both', false) + expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'both', false, false) //formatting component.downloadForm.get('downloadUseFormatting').patchValue(true) component.downloadSelected() - expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'both', true) + expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'both', false, true) + //merging + component.downloadForm.get('downloadFileTypeOriginals').patchValue(true) + component.downloadForm.get('downloadFileTypeArchive').patchValue(false) + component.downloadForm.get('downloadAsSingleFile').patchValue(true) + component.downloadSelected() + expect(downloadSpy).toHaveBeenCalledWith([3, 4], 'originals', true, false) httpTestingController.match( `${environment.apiBaseUrl}documents/bulk_download/` diff --git a/src-ui/src/app/services/rest/document.service.spec.ts b/src-ui/src/app/services/rest/document.service.spec.ts index 8576a2399..4c97501e7 100644 --- a/src-ui/src/app/services/rest/document.service.spec.ts +++ b/src-ui/src/app/services/rest/document.service.spec.ts @@ -137,10 +137,11 @@ describe(`DocumentService`, () => { it('should call appropriate api endpoint for bulk download', () => { const ids = [1, 2, 3] - const content = 'both' + const content = 'originals' + const mergeIntoSingleFile = false const useFilenameFormatting = false subscription = service - .bulkDownload(ids, content, useFilenameFormatting) + .bulkDownload(ids, content, mergeIntoSingleFile, useFilenameFormatting) .subscribe() const req = httpTestingController.expectOne( `${environment.apiBaseUrl}${endpoint}/bulk_download/` @@ -149,6 +150,7 @@ describe(`DocumentService`, () => { expect(req.request.body).toEqual({ documents: ids, content, + single_file: mergeIntoSingleFile, follow_formatting: useFilenameFormatting, }) })