All files / platform/core/src/DICOMWeb getModalities.test.js

0% Statements 0/25
100% Branches 0/0
0% Functions 0/7
0% Lines 0/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71                                                                                                                                             
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;
 
    expect(getModalities(Modality, ModalitiesInStudy)).toEqual({});
  });
 
  test('should return an empty object when Modality and ModalitiesInStudy are not present', () => {
    const Modality = null;
    const ModalitiesInStudy = null;
 
    expect(getModalities(Modality, ModalitiesInStudy)).toEqual({});
  });
 
  test('should return modalities in Study when Modality is not defined', () => {
    const Modality = null;
 
    const ModalitiesInStudy = {
      Value: ['MOCKED_VALUE'],
      vr: 'MOCKED_VALUE',
    };
 
    expect(getModalities(Modality, ModalitiesInStudy)).toEqual(ModalitiesInStudy);
  });
 
  test('should return only the modalitues that exists in ModalitiesInStudy', () => {
    const Modality = {
      Value: ['DESIRED_VALUE'],
      vr: 'DESIRED_VR',
    };
 
    const ModalitiesInStudy = {
      Value: ['DESIRED_VALUE', 'NOT_DESIRED_VALUE'],
      vr: 'DESIRED_VR',
    };
 
    expect(getModalities(Modality, ModalitiesInStudy)).toEqual(Modality);
  });
 
  test('should return the seek Modality when the desired Modality does not exist in ModalitiesInStudy', () => {
    const Modality = {
      Value: ['DESIRED_VALUE'],
      vr: 'DESIRED_VR',
    };
 
    const ModalitiesInStudy = {
      Value: ['NOT_DESIRED_VALUE'],
      vr: 'DESIRED_VR',
    };
 
    expect(getModalities(Modality, ModalitiesInStudy)).toEqual(Modality);
  });
 
  test('should return the seek Modality when the desired Modality does not exist in ModalitiesInStudy VR', () => {
    const Modality = {
      Value: ['DESIRED_VALUE'],
      vr: 'DESIRED_VR',
    };
 
    const ModalitiesInStudy = {
      Value: ['NOT_DESIRED_VALUE'],
      vr: 'ANOTHER_VR',
    };
 
    expect(getModalities(Modality, ModalitiesInStudy)).toEqual(ModalitiesInStudy);
  });
});