-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(viewer): use unsupported file type error message for .boxdicom #1437
Changes from 3 commits
0d71d12
207fd78
4863d56
838b831
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,21 +16,29 @@ describe('lib/viewers/iframe/IFrameLoader', () => { | |
}, | ||
}); | ||
|
||
test('should have the correct viewer', () => { | ||
const iframeViewer = IFrameLoader.viewers[0]; | ||
expect(iframeViewer).toEqual({ | ||
NAME: 'IFrame', | ||
CONSTRUCTOR: IFrameViewer, | ||
REP: 'ORIGINAL', | ||
EXT: ['boxnote', 'boxdicom'], | ||
}); | ||
test('should have the correct viewers', () => { | ||
const iframeViewers = IFrameLoader.viewers; | ||
expect(iframeViewers).toEqual([ | ||
{ | ||
NAME: 'IFrame', | ||
CONSTRUCTOR: IFrameViewer, | ||
REP: 'ORIGINAL', | ||
EXT: ['boxdicom'], | ||
}, | ||
{ | ||
NAME: 'IFrame', | ||
CONSTRUCTOR: IFrameViewer, | ||
REP: 'ORIGINAL', | ||
EXT: ['boxnote'], | ||
}, | ||
]); | ||
}); | ||
|
||
test.each` | ||
disableDicom | fileType | viewerInstance | ||
${false} | ${'boxdicom'} | ${IFrameLoader.viewers.find(v => v.EXT.includes('boxdicom'))} | ||
${true} | ${'boxdicom'} | ${undefined} | ||
${true} | ${'boxnote'} | ${IFrameLoader.viewers[0]} | ||
${false} | ${'boxdicom'} | ${IFrameLoader.viewers[0]} | ||
${true} | ${'boxnote'} | ${IFrameLoader.viewers.find(v => v.EXT.includes('boxnote'))} | ||
`( | ||
'should return correct result depending on the disableDicom viewer option and file type', | ||
({ disableDicom, fileType, viewerInstance }) => { | ||
|
@@ -43,6 +51,7 @@ describe('lib/viewers/iframe/IFrameLoader', () => { | |
}; | ||
const viewer = IFrameLoader.determineViewer(iframe.options.file, [], viewerOptions); | ||
expect(viewer).toEqual(viewerInstance); | ||
expect(IFrameLoader.getViewers().some(v => v.EXT.includes('boxdicom'))).toEqual(!disableDicom); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this assertion if we already have the one above it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could, the assertion checks if the list of viewers is correct based on the disableDicom viewer option. While the above assertion checks if the viewer instance is correct. |
||
}, | ||
); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need to check if
isDicomFile
is true anymore? IfdisableDicom
option is passed in, would it work if we just remove it from thethis.viewers
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, it doesn't really matter about the current file, we should just remove the dicom viewer from the supported viewers if the disableDicom is true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May want to update the comment as well to be consistent with the code