Files
ohif-viewer/platform/core/src/DICOMWeb/getModalities.test.js
T

74 lines
2.0 KiB
JavaScript
Raw Normal View History

2019-08-13 15:36:46 -04:00
import getModalities from './getModalities';
describe('getModalities', () => {
test('should return an empty object when Modality and ModalitiesInStudy are not present', () => {
const Modality = null;
const ModalitiesInStudy = null;
2019-08-13 15:36:46 -04:00
expect(getModalities(Modality, ModalitiesInStudy)).toEqual({});
2019-08-13 15:36:46 -04:00
});
test('should return an empty object when Modality and ModalitiesInStudy are not present', () => {
const Modality = null;
const ModalitiesInStudy = null;
2019-08-13 15:36:46 -04:00
expect(getModalities(Modality, ModalitiesInStudy)).toEqual({});
2019-08-13 15:36:46 -04:00
});
test('should return modalities in Study when Modality is not defined', () => {
const Modality = null;
2019-08-13 15:36:46 -04:00
const ModalitiesInStudy = {
2019-08-13 15:36:46 -04:00
Value: ['MOCKED_VALUE'],
vr: 'MOCKED_VALUE',
};
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(
ModalitiesInStudy
2019-08-13 15:36:46 -04:00
);
});
test('should return only the modalitues that exists in ModalitiesInStudy', () => {
const Modality = {
2019-08-13 15:36:46 -04:00
Value: ['DESIRED_VALUE'],
vr: 'DESIRED_VR',
};
const ModalitiesInStudy = {
2019-08-13 15:36:46 -04:00
Value: ['DESIRED_VALUE', 'NOT_DESIRED_VALUE'],
vr: 'DESIRED_VR',
};
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(Modality);
2019-08-13 15:36:46 -04:00
});
test('should return the seek Modality when the desired Modality does not exist in ModalitiesInStudy', () => {
const Modality = {
2019-08-13 15:36:46 -04:00
Value: ['DESIRED_VALUE'],
vr: 'DESIRED_VR',
};
const ModalitiesInStudy = {
2019-08-13 15:36:46 -04:00
Value: ['NOT_DESIRED_VALUE'],
vr: 'DESIRED_VR',
};
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(Modality);
2019-08-13 15:36:46 -04:00
});
test('should return the seek Modality when the desired Modality does not exist in ModalitiesInStudy VR', () => {
const Modality = {
2019-08-13 15:36:46 -04:00
Value: ['DESIRED_VALUE'],
vr: 'DESIRED_VR',
};
const ModalitiesInStudy = {
2019-08-13 15:36:46 -04:00
Value: ['NOT_DESIRED_VALUE'],
vr: 'ANOTHER_VR',
};
expect(getModalities(Modality, ModalitiesInStudy)).toEqual(
ModalitiesInStudy
2019-08-13 15:36:46 -04:00
);
});
});