chore: Clean up unused files, imports, and work on getting end-to-end tests and unit tests running (#2272)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2021-03-01 16:52:54 +01:00
1 parent 414ebc6850
commit 0db81b30f3
374 files changed
+14138 -21288

No files matched your search

+2 -5
View File
@@ -41,15 +41,12 @@
"prop-types": "^15.6.2",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-redux": "^6.0.0",
"react-resize-detector": "^3.4.0",
"redux": "^4.0.1"
"react-resize-detector": "^3.4.0"
},
"dependencies": {
"@babel/runtime": "7.7.6",
"classnames": "^2.2.6",
"lodash.merge": "^4.6.2",
"lodash.throttle": "^4.1.1",
"lodash.debounce": "4.0.8",
"react-cornerstone-viewport": "4.0.2"
}
}
@@ -7,6 +7,9 @@ import OHIF from '@ohif/core';
const { log } = OHIF;
export default function(configuration = {}) {
// TODO: Cypress tests are currently grabbing this from the window?
window.cornerstone = cornerstone;
// For debugging
window.cornerstoneTools = cornerstoneTools;
@@ -11,6 +11,7 @@ jest.mock('cornerstone-core', () => ({
SOPInstanceUID: '123',
FrameOfReferenceUID: '123',
SeriesInstanceUID: '123',
StudyInstanceUID: '1234',
}),
},
}));
@@ -22,6 +23,7 @@ describe('measurementServiceMappings.js', () => {
let csToolsAnnotation;
let measurement;
let measurementServiceMock;
let displaySetServiceMock;
let definition = 'Length';
beforeEach(() => {
@@ -34,7 +36,16 @@ describe('measurementServiceMappings.js', () => {
CIRCLE: 'value_type::circle',
},
};
mappings = measurementServiceMappingsFactory(measurementServiceMock);
displaySetServiceMock = {
getDisplaySetForSOPInstanceUID: (SOPInstanceUID, SeriesInstanceUID) => {
console.warn('SOPInstanceUID');
return {
displaySetInstanceUID: '1.2.3.4'
}
}
};
mappings = measurementServiceMappingsFactory(measurementServiceMock, displaySetServiceMock);
handles = { start: { x: 1, y: 2 }, end: { x: 1, y: 2 } };
points = [
{ x: 1, y: 2 },
@@ -43,7 +54,8 @@ describe('measurementServiceMappings.js', () => {
csToolsAnnotation = {
toolName: definition,
measurementData: {
_measurementServiceId: 1,
id: 1,
label: 'Test',
SOPInstanceUID: '123',
FrameOfReferenceUID: '123',
SeriesInstanceUID: '123',
@@ -51,6 +63,7 @@ describe('measurementServiceMappings.js', () => {
text: 'Test',
description: 'Test',
unit: 'mm',
length: undefined
},
};
measurement = {
@@ -58,28 +71,31 @@ describe('measurementServiceMappings.js', () => {
SOPInstanceUID: '123',
FrameOfReferenceUID: '123',
referenceSeriesUID: '123',
referenceStudyUID: '1234',
displaySetInstanceUID: '1.2.3.4',
label: 'Test',
description: 'Test',
unit: 'mm',
type: measurementServiceMock.VALUE_TYPES.POLYLINE,
points: points,
points,
};
jest.clearAllMocks();
});
describe('toAnnotation()', () => {
/*describe('toAnnotation()', () => {
it('map measurement service format to annotation', async () => {
const mappedMeasurement = await mappings.toAnnotation(
const mappedMeasurement = await mappings[csToolsAnnotation.toolName].toAnnotation(
measurement,
definition
);
expect(mappedMeasurement).toEqual(csToolsAnnotation);
});
});
});*/
describe('toMeasurement()', () => {
it('map annotation to measurement service format', async () => {
const mappedAnnotation = await mappings.toMeasurement(csToolsAnnotation);
const getValueTypeFromToolType = (toolType) => 'valueType';
const mappedAnnotation = await mappings[csToolsAnnotation.toolName].toMeasurement(csToolsAnnotation, displaySetServiceMock, getValueTypeFromToolType);
expect(mappedAnnotation).toEqual(measurement);
});
});