chanzuckerberg / single-cell-data-portal

The data portal supporting the submission, exploration, and management of projects and datasets to cellxgene.
MIT License
63 stars 12 forks source link

Add extensive test coverage for tissue expansion #5827

Closed tihuan closed 1 year ago

tihuan commented 1 year ago
  1. Connected to #5739, since tissue expansion is actually very complicated in , in order to ensure behaviors work as expected, let's write extensive test coverage for this!

  2. Test cases:

    • [x] 1. "Filter tissue auto expansion": Click the first tissue to expand, filter two tissues from left panel. Expect only two tissues present and both expanded automatically
    • [x] 2. "Filter tissue auto expansion - respect user collapsed tissue state": Filter first two tissues from the left panel, collapse the first tissue, add third tissue from the left panel. Expect the first tissue to stay collapsed, and the other two tissues expanded
    • [x] 3. "Filter tissue auto expansion - exit filter tissues mode": Filter two tissues, expect tissues to be expanded. Remove both tissues from filter. Expect showing all tissues in collapsed state
    • [x] 4. "Filter cell type auto expansion": Filter cell type "B cell". Expect tissue list to only show tissues that contain "B cell" and automatically expanded
    • [x] 5. "Filter cell type auto expansion - exit filter cell types mode": Filter "B cell", expect only show tissues that contain "B cell" and expanded. Remove "B cell" filter, expect showing all tissues in collapsed state
    • [x] 6. "Filter cell type auto expansion - override tissue filter collapse state": Filter first 2 tissues in left panel, collapse both tissues, filter "B cell". Expect both tissues to expand and only has "B cell" row
    • [x] 7. Filter two tissues, filter top 3 cell types (B cell, B-1a B cell, and B-1b B cell). Expect both tissues expanded. Remove “B cell” from filter <-- this removes tissue filter, since only “Lung” tissue has B-1a B cell and B-1b B cell. I see Lung is shown, but the bug is that “Lung” tissue is NOT automatically expanded
    • [x] 8. Tissue auto expansion - cross filter with Sex filter selected: filter Female from Sex filter. Filter Abdomen and Blood from the Tissue filter - Abdomen and Blood should be expanded, Add Cell type filtering, only B Cell type should appear and expanded.
    • [x] 9. Tissue auto expansion - cross filter with Sex filter, check expansion: filter 3 Tissues ["abdomen", "axilla", "blood"]. Collapse Abdomen. Select Female from the Sex filter. Tissue filter should now only have Abdomen and Blood selected. Only Abdomen and Blood should be visible. Abdomen should remain collapsed. Remove Sex filter. Cell count should increase. Tissue filter should now only have Abdomen and Blood selected. Only Abdomen and Blood should be visible. Abdomen should remain collapsed.
    • [x] 10. Tissue auto expansion - cross filter with Publication filter selected: filter 'Ahren et al. Cell 2022' from the Publication filter. Filter Blood from the tissue filter. Blood should be expanded. Collapse Blood. add Cell filter for B Cell. Only B Cell should appear and Blood should be expanded.
    • [x] 11. Tissue auto expansion - cross filter with Publication filter, check expansion: filter 3 Tissues ["abdomen", "axilla", "brain"]. Collapse Brain. Filter 'Ahren et al. Neuron 2021' from the Publication filter. Only Brain should remain visible and collapsed. Add Cell filter for interneuron. Only interneuron should be visible under expanded Brain tissue node
    • [x] 12. Tissue auto expansion - cross filter with Self-Reported Ethnicity filter: Expand Breast. Select African from Ethnicity filter. Breast should remain expanded. Add Nose to the Tissue filter. Nose should appear expanded.
    • [x] 13. Tissue auto expansion - cross filter with Disease filter: filter 3 Tissues ["abdomen", "axilla", "brain"]. From the Disease filter select influenza. Blood should appear only and expanded. Add cell type filter for B Cell. Only B Cell should appear under Blood and expanded. Remove influenza. Blood should remain expanded and cell count increase.
    • [x] 14. Tissue auto expansion - cross filter with Dataset filter: filter 3 Tissues ["abdomen", "axilla", "brain"]. From the Dataset filter select Combined Samples. Axilla and Brain should appear only and expanded. Add cell type filter for B Cell. Only B Cell should appear under Axilla and Brain and expanded. Remove B Cell. Remove Combined Samples. Blood should remain expanded and cell count increase after removal of Dataset filter.
tihuan commented 1 year ago

@kaloster @seve please help see if there are edge cases not covered!

I tried to include entering and exiting tissue filter auto expansion, entering and exiting cell type filter auto expansion, and then one test case for tissue filter and cell type filter modes interacting with each other, but probably more test cases can be included (e.g., both modes present, exiting one mode. And another case with both modes present, exiting the other mode, etc.)

Thank you!