Skip to content
Snippets Groups Projects
Commit b8099e69 authored by Xiao Gui's avatar Xiao Gui
Browse files

fix unit test

parent e1f5a714
No related branches found
No related tags found
No related merge requests found
......@@ -328,16 +328,22 @@ const getRegionInOtherTemplateSelectorBundle = (version: EnumParcRegVersion) =>
describe('> region.base.ts', () => {
describe('> regionInOtherTemplateSelector', () => {
// TODO
it('> only selects region in the template specified by selected atlas')
for (const enumKey of Object.keys(EnumParcRegVersion)) {
describe(`> selector version for ${enumKey}`, () => {
const { mockFetchedTemplates, mr0, mt2, mt0, mp0, mt1, mp1h, mr0lh, mt3, mr0rh } = getRegionInOtherTemplateSelectorBundle(enumKey as EnumParcRegVersion)
let selectedAtlas = {
templateSpaces: mockFetchedTemplates
}
describe('> no hemisphere selected, simulates big brain cyto map', () => {
let result: any[]
beforeAll(() => {
result = regionInOtherTemplateSelector.projector(mockFetchedTemplates, mt0, { region: mr0 })
result = regionInOtherTemplateSelector.projector(selectedAtlas, mockFetchedTemplates, mt0, { region: mr0 })
})
it('> length checks out', () => {
......@@ -409,7 +415,7 @@ describe('> region.base.ts', () => {
describe('> hemisphere data selected (left hemisphere), simulates julich-brain in mni152', () => {
let result
beforeAll(() => {
result = regionInOtherTemplateSelector.projector(mockFetchedTemplates, mt2, { region: mr0lh })
result = regionInOtherTemplateSelector.projector(selectedAtlas, mockFetchedTemplates, mt2, { region: mr0lh })
})
it('> length checks out', () => {
......
......@@ -261,7 +261,7 @@ export const regionInOtherTemplateSelector = createSelector(
viewerStateFetchedTemplatesSelector,
viewerStateSelectedTemplateSelector,
(atlas, fetchedTemplates, templateSelected, prop) => {
const atlasTemplateSpacesIds = atlas.templateSpaces.map(({ ['@id']: id }) => id)
const atlasTemplateSpacesIds = atlas.templateSpaces.map(({ ['@id']: id, fullId }) => id || fullId)
const { region: regionOfInterest } = prop
const returnArr = []
......@@ -276,7 +276,7 @@ export const regionInOtherTemplateSelector = createSelector(
const otherTemplates = fetchedTemplates
.filter(({ fullId }) => getIdFromFullId(fullId) !== selectedTemplateId)
.filter(({ ['@id']: id }) => atlasTemplateSpacesIds.includes(id))
.filter(({ ['@id']: id, fullId }) => atlasTemplateSpacesIds.includes(id || fullId))
for (const template of otherTemplates) {
for (const parcellation of template.parcellations) {
const flattenedRegions = flattenRegions(parcellation.regions)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment