From 55476107bfd3d7031471394494b9c1bbbf847867 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrian=20Or=C5=82=C3=B3w?= <adrian.orlow@fishbrain.com>
Date: Wed, 3 Jan 2024 17:19:37 +0100
Subject: [PATCH] fix: Compartment is a number, should be a name

---
 .../BioEntityDrawer/BioEntityDrawer.component.tsx     |  8 ++++----
 .../BioEntitiesAccordion.component.test.tsx           |  6 +++---
 src/models/bioEntitySchema.ts                         | 11 ++++++-----
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx b/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx
index 8bf424af..2d60852e 100644
--- a/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx
+++ b/src/components/Map/Drawer/BioEntityDrawer/BioEntityDrawer.component.tsx
@@ -1,7 +1,7 @@
-import { DrawerHeading } from '@/shared/DrawerHeading';
-import { useAppSelector } from '@/redux/hooks/useAppSelector';
-import { searchedFromMapBioEntityElement } from '@/redux/bioEntity/bioEntity.selectors';
 import { ZERO } from '@/constants/common';
+import { searchedFromMapBioEntityElement } from '@/redux/bioEntity/bioEntity.selectors';
+import { useAppSelector } from '@/redux/hooks/useAppSelector';
+import { DrawerHeading } from '@/shared/DrawerHeading';
 import { AnnotationItem } from './AnnotationItem';
 import { AssociatedSubmap } from './AssociatedSubmap';
 
@@ -26,7 +26,7 @@ export const BioEntityDrawer = (): React.ReactNode => {
       />
       <div className="flex flex-col gap-6 p-6">
         <div className="text-sm font-normal">
-          Compartment: <b className="font-semibold">{bioEntityData.compartment}</b>
+          Compartment: <b className="font-semibold">{bioEntityData.compartmentName}</b>
         </div>
         {bioEntityData.fullName && (
           <div className="text-sm font-normal">
diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/GroupedSearchResults/BioEntitiesAccordion/BioEntitiesAccordion.component.test.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/GroupedSearchResults/BioEntitiesAccordion/BioEntitiesAccordion.component.test.tsx
index bc8a61dd..b16f5069 100644
--- a/src/components/Map/Drawer/SearchDrawerWrapper/GroupedSearchResults/BioEntitiesAccordion/BioEntitiesAccordion.component.test.tsx
+++ b/src/components/Map/Drawer/SearchDrawerWrapper/GroupedSearchResults/BioEntitiesAccordion/BioEntitiesAccordion.component.test.tsx
@@ -1,6 +1,6 @@
+import { bioEntitiesContentFixture } from '@/models/fixtures/bioEntityContentsFixture';
 import { MODELS_MOCK } from '@/models/mocks/modelsMock';
 import { StoreType } from '@/redux/store';
-import { bioEntitiesContentFixture } from '@/models/fixtures/bioEntityContentsFixture';
 import { Accordion } from '@/shared/Accordion';
 import {
   InitialStoreState,
@@ -73,7 +73,7 @@ describe('BioEntitiesAccordion - component', () => {
     });
 
     expect(screen.getByText('Content (10)')).toBeInTheDocument();
-    expect(screen.getByText('Core PD map (4)')).toBeInTheDocument();
-    expect(screen.getByText('Histamine signaling (1)')).toBeInTheDocument();
+    expect(screen.getByText('Core PD map (3)')).toBeInTheDocument();
+    expect(screen.getByText('Histamine signaling (5)')).toBeInTheDocument();
   });
 });
diff --git a/src/models/bioEntitySchema.ts b/src/models/bioEntitySchema.ts
index 9014bc87..5a66d612 100644
--- a/src/models/bioEntitySchema.ts
+++ b/src/models/bioEntitySchema.ts
@@ -1,13 +1,13 @@
 import { z } from 'zod';
-import { referenceSchema } from './referenceSchema';
-import { glyphSchema } from './glyphSchema';
-import { modificationResiduesSchema } from './modificationResiduesSchema';
-import { submodelSchema } from './submodelSchema';
 import { colorSchema } from './colorSchema';
-import { productsSchema } from './products';
+import { glyphSchema } from './glyphSchema';
 import { lineSchema } from './lineSchema';
+import { modificationResiduesSchema } from './modificationResiduesSchema';
 import { operatorSchema } from './operatorSchema';
+import { productsSchema } from './products';
+import { referenceSchema } from './referenceSchema';
 import { structuralStateSchema } from './structuralStateSchema';
+import { submodelSchema } from './submodelSchema';
 
 export const bioEntitySchema = z.object({
   id: z.number(),
@@ -33,6 +33,7 @@ export const bioEntitySchema = z.object({
   synonyms: z.array(z.string()),
   formerSymbols: z.array(z.string()),
   fullName: z.string().nullable(),
+  compartmentName: z.string().nullable(),
   abbreviation: z.string().nullable(),
   formula: z.string().nullable(),
   glyph: glyphSchema.nullable(),
-- 
GitLab