From b9a1a16af5af45d83e8c5a1cd603a0dc548d4f6d Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Mon, 15 Jan 2024 11:47:06 -0600 Subject: [PATCH] Add test to download a single DICOM file We also now verify that each download contains a certain amount of bytes. Signed-off-by: Patrick Avery --- .../web_client_specs/dicomWebSpec.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sources/dicom/test_dicom/web_client_specs/dicomWebSpec.js b/sources/dicom/test_dicom/web_client_specs/dicomWebSpec.js index d0d4c9deb..653a516ab 100644 --- a/sources/dicom/test_dicom/web_client_specs/dicomWebSpec.js +++ b/sources/dicom/test_dicom/web_client_specs/dicomWebSpec.js @@ -13,10 +13,12 @@ describe('DICOMWeb assetstore', function () { 'Admin', 'Admin', 'adminpassword!')); + it('Create an assetstore and import data', function () { var destinationId; var destinationType; var itemId; + var fileId; // After importing, we will verify that this item exists const verifyItemName = '1.3.6.1.4.1.5962.99.1.3205815762.381594633.1639588388306.2.0'; @@ -200,8 +202,9 @@ describe('DICOMWeb assetstore', function () { return false; } - // Save the itemId + // Save the itemId, and the file id itemId = items[0]['_id']; + fileId = items[0].largeImage.fileId; return true }, 'Wait for large images to be present'); @@ -212,7 +215,21 @@ describe('DICOMWeb assetstore', function () { type: 'GET', async: false, }); - return resp.status === 200; - }, 'Wait to download the DICOM files'); + + // Should be larger than 10 million bytes + return resp.status === 200 && resp.responseText.length > 10000000; + }, 'Wait to download all DICOM files in the item'); + + // Verify that we can download a single file + waitsFor(function () { + const resp = girder.rest.restRequest({ + url: 'file/' + fileId + '/download', + type: 'GET', + async: false, + }); + + // Should be larger than 500k bytes + return resp.status === 200 && resp.responseText.length > 500000; + }, 'Wait to download a single DICOM file'); }); });