@@ -26,18 +26,20 @@ describe("HCAGetDataFileSummaryComponent", () => {
2626 let component : HCAGetDataFileSummaryComponent ;
2727 let fixture : ComponentFixture < HCAGetDataFileSummaryComponent > ;
2828
29- const SUMMARY_DISPLAY_ORDER = [ "Projects" , "Species" , "Library Construction Method" , "Paired End" , "Donors" , "Specimens" , "Estimated Cells" , "Files" , "File Size" ] ;
29+ const SUMMARY_DISPLAY_ORDER = [ "Projects" , "Species" , "Library Construction Method" , "Organ" , "Organ Part" , " Paired End", "Donors" , "Specimens" , "Estimated Cells" , "Files" , "File Size" ] ;
3030
3131 // Summary order by index
32- const PROJECT_COUNT_INDEX = 0 ;
33- const SPECIES_COUNT_INDEX = 1 ;
34- const LIBRARY_CONSTRUCTION_METHOD_COUNT_INDEX = 2 ;
35- const PAIRED_END_COUNT_INDEX = 3 ;
36- const DONORS_COUNT_INDEX = 4 ;
37- const SPECIMENS_COUNT_INDEX = 5 ;
38- const ESTIMATED_CELLS_COUNT_INDEX = 6 ;
39- const FILES_COUNT_INDEX = 7 ;
40- const FILE_SIZE_COUNT_INDEX = 8 ;
32+ const INDEX_PROJECT_COUNT = 0 ;
33+ const INDEX_GENUS_SPECIES = 1 ;
34+ const INDEX_LIBRARY_CONSTRUCTION_METHOD = 2 ;
35+ const INDEX_ORGAN = 3 ;
36+ const INDEX_ORGAN_PART = 4 ;
37+ const INDEX_PAIRED_END = 5 ;
38+ const INDEX_DONORS_COUNT = 6 ;
39+ const INDEX_SPECIMENS_COUNT = 7 ;
40+ const INDEX_ESTIMATED_CELLS_COUNT = 8 ;
41+ const INDEX_FILES_COUNT = 9 ;
42+ const INDEX_FILE_SIZE_COUNT = 10 ;
4143
4244 beforeEach ( async ( ( ) => {
4345
@@ -216,8 +218,8 @@ describe("HCAGetDataFileSummaryComponent", () => {
216218 // labels "Files" and "File Size".
217219 getSummaryEls ( ) . forEach ( ( el , index ) => {
218220 expect ( getSummaryLabelInnerHTML ( el ) ) . toEqual ( ( SUMMARY_DISPLAY_ORDER [ index ] ) ) ;
219- expect ( getSummaryLabelInnerHTML ( el ) ) . not . toEqual ( SUMMARY_DISPLAY_ORDER [ FILES_COUNT_INDEX ] ) ;
220- expect ( getSummaryLabelInnerHTML ( el ) ) . not . toEqual ( SUMMARY_DISPLAY_ORDER [ FILE_SIZE_COUNT_INDEX ] ) ;
221+ expect ( getSummaryLabelInnerHTML ( el ) ) . not . toEqual ( SUMMARY_DISPLAY_ORDER [ INDEX_FILES_COUNT ] ) ;
222+ expect ( getSummaryLabelInnerHTML ( el ) ) . not . toEqual ( SUMMARY_DISPLAY_ORDER [ INDEX_FILE_SIZE_COUNT ] ) ;
221223 } ) ;
222224 } ) ;
223225
@@ -235,7 +237,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
235237 // Confirm project count value is displayed, when view mode is "NONE" - first execute a query
236238 // to find the element with the class "count" where the element with the class "label" is "Projects"
237239 // and confirm the value is equal to project count.
238- expect ( getCountInnerHTML ( PROJECT_COUNT_INDEX ) ) . toEqual ( component . summary . projectCount . toLocaleString ( ) ) ;
240+ expect ( getCountInnerHTML ( INDEX_PROJECT_COUNT ) ) . toEqual ( component . summary . projectCount . toLocaleString ( ) ) ;
239241 } ) ;
240242
241243 /**
@@ -252,7 +254,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
252254 // Confirm donor count value is displayed, when view mode is "NONE" - first execute a query
253255 // to find the element with the class "count" where the element with the class "label" is "Donors"
254256 // and confirm the value is equal to donor count.
255- expect ( getCountInnerHTML ( DONORS_COUNT_INDEX ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . donorCount ) ) ;
257+ expect ( getCountInnerHTML ( INDEX_DONORS_COUNT ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . donorCount ) ) ;
256258 } ) ;
257259
258260 /**
@@ -269,7 +271,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
269271 // Confirm specimen count value is displayed, when view mode is "NONE" - first execute a query
270272 // to find the element with the class "count" where the element with the class "label" is "Specimens"
271273 // and confirm the value is equal to specimen count.
272- expect ( getCountInnerHTML ( SPECIMENS_COUNT_INDEX ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . specimenCount ) ) ;
274+ expect ( getCountInnerHTML ( INDEX_SPECIMENS_COUNT ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . specimenCount ) ) ;
273275 } ) ;
274276
275277 /**
@@ -286,7 +288,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
286288 // Confirm total cell count value is displayed, when view mode is "NONE" - first execute a query
287289 // to find the element with the class "count" where the element with the class "label" is "Estimated Cells"
288290 // and confirm the value is equal to total cell count.
289- expect ( getCountInnerHTML ( ESTIMATED_CELLS_COUNT_INDEX ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . totalCellCount ) ) ;
291+ expect ( getCountInnerHTML ( INDEX_ESTIMATED_CELLS_COUNT ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . totalCellCount ) ) ;
290292 } ) ;
291293
292294 /**
@@ -303,7 +305,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
303305 // Confirm file count value is displayed, when view mode is "NONE" - first execute a query
304306 // to find the element with the class "count" where the element with the class "label" is "Files"
305307 // and confirm the value is equal to file count.
306- expect ( getCountInnerHTML ( FILES_COUNT_INDEX ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . fileCount ) ) ;
308+ expect ( getCountInnerHTML ( INDEX_FILES_COUNT ) ) . toEqual ( new CountSizePipe ( ) . transform ( component . summary . fileCount ) ) ;
307309 } ) ;
308310
309311 /**
@@ -320,7 +322,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
320322 // Confirm file size count value is displayed, when view mode is "NONE" - first execute a query
321323 // to find the element with the class "count" where the element with the class "label" is "File Size"
322324 // and confirm the value is equal to file size count.
323- expect ( getCountInnerHTML ( FILE_SIZE_COUNT_INDEX ) ) . toEqual ( new FileSizePipe ( ) . transform ( component . summary . totalFileSize ) ) ;
325+ expect ( getCountInnerHTML ( INDEX_FILE_SIZE_COUNT ) ) . toEqual ( new FileSizePipe ( ) . transform ( component . summary . totalFileSize ) ) ;
324326 } ) ;
325327
326328 /**
@@ -343,7 +345,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
343345 // Confirm selected genus species is displayed, when view mode is "NONE" - first execute a query
344346 // to find the element with the class "terms" where the element with the class "label" is "Species"
345347 // and confirm the value is equal to the concatenated term names.
346- expect ( getTermInnerHTML ( SPECIES_COUNT_INDEX ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
348+ expect ( getTermInnerHTML ( INDEX_GENUS_SPECIES ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
347349 } ) ;
348350
349351 /**
@@ -367,7 +369,53 @@ describe("HCAGetDataFileSummaryComponent", () => {
367369 // Confirm selected library construction approaches is displayed, when view mode is "NONE" - first execute a query
368370 // to find the element with the class "terms" where the element with the class "label" is "Library Construction Method"
369371 // and confirm the value is equal to the concatenated term names.
370- expect ( getTermInnerHTML ( LIBRARY_CONSTRUCTION_METHOD_COUNT_INDEX ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
372+ expect ( getTermInnerHTML ( INDEX_LIBRARY_CONSTRUCTION_METHOD ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
373+ } ) ;
374+
375+ /**
376+ * Confirm selected organs is displayed, when view mode is "NONE".
377+ */
378+ it ( `should display selected organs when view mode is "NONE"` , ( ) => {
379+
380+ const selectedTerms = [
381+ new Term ( "blood" , 22 , true ) ,
382+ new Term ( "lung" , 22 , true )
383+ ] ;
384+
385+ // Set up initial component state
386+ component . viewState = DownloadViewState . NONE ;
387+ component . selectedOrgans = selectedTerms ;
388+
389+ // Trigger change detection so template updates accordingly
390+ fixture . detectChanges ( ) ;
391+
392+ // Confirm selected organs is displayed, when view mode is "NONE" - first execute a query
393+ // to find the element with the class "terms" where the element with the class "label" is "Organ"
394+ // and confirm the value is equal to the concatenated term names.
395+ expect ( getTermInnerHTML ( INDEX_ORGAN ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
396+ } ) ;
397+
398+ /**
399+ * Confirm selected organ parts is displayed, when view mode is "NONE".
400+ */
401+ it ( `should display selected organ parts when view mode is "NONE"` , ( ) => {
402+
403+ const selectedTerms = [
404+ new Term ( "amygdala" , 22 , true ) ,
405+ new Term ( "islet of Langerhans" , 22 , true )
406+ ] ;
407+
408+ // Set up initial component state
409+ component . viewState = DownloadViewState . NONE ;
410+ component . selectedOrganParts = selectedTerms ;
411+
412+ // Trigger change detection so template updates accordingly
413+ fixture . detectChanges ( ) ;
414+
415+ // Confirm selected organ parts is displayed, when view mode is "NONE" - first execute a query
416+ // to find the element with the class "terms" where the element with the class "label" is "Organ Parts"
417+ // and confirm the value is equal to the concatenated term names.
418+ expect ( getTermInnerHTML ( INDEX_ORGAN_PART ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
371419 } ) ;
372420
373421 /**
@@ -389,7 +437,7 @@ describe("HCAGetDataFileSummaryComponent", () => {
389437 // Confirm selected paired Ends is displayed, when view mode is "NONE" - first execute a query
390438 // to find the element with the class "terms" where the element with the class "label" is "Paired End"
391439 // and confirm the value is equal to the concatenated term names.
392- expect ( getTermInnerHTML ( PAIRED_END_COUNT_INDEX ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
440+ expect ( getTermInnerHTML ( INDEX_PAIRED_END ) ) . toEqual ( component . displayTerms ( selectedTerms ) ) ;
393441 } ) ;
394442
395443 /**
0 commit comments