From 748bfc6b93e090210e79f13d4860737eec7f5f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Or=C5=82=C3=B3w?= <adrian.orlow@fishbrain.com> Date: Thu, 30 Nov 2023 12:20:11 +0100 Subject: [PATCH] fix: map render not working with covid map --- .../PinsList/PinsList.component.test.tsx | 14 +++++++------- .../PinsListItem/PinsListItem.component.test.tsx | 16 ++++++++-------- src/models/authorSchema.ts | 10 +++++++++- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsList.component.test.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsList.component.test.tsx index 485dd029..3b381a37 100644 --- a/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsList.component.test.tsx +++ b/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsList.component.test.tsx @@ -1,14 +1,14 @@ -import { render, screen } from '@testing-library/react'; +import { chemicalsFixture } from '@/models/fixtures/chemicalsFixture'; +import { drugsFixture } from '@/models/fixtures/drugFixtures'; +import { mirnasFixture } from '@/models/fixtures/mirnasFixture'; +import { StoreType } from '@/redux/store'; import { InitialStoreState, getReduxWrapperWithStore, } from '@/utils/testing/getReduxWrapperWithStore'; -import { drugsFixture } from '@/models/fixtures/drugFixtures'; -import { chemicalsFixture } from '@/models/fixtures/chemicalsFixture'; -import { mirnasFixture } from '@/models/fixtures/mirnasFixture'; -import { StoreType } from '@/redux/store'; -import { PinItem, PinType } from './PinsList.types'; +import { render, screen } from '@testing-library/react'; import { PinsList } from './PinsList.component'; +import { PinItem, PinTypeWithNone } from './PinsList.types'; const DRUGS_PINS_LIST = drugsFixture.map(drug => ({ id: drug.id, @@ -30,7 +30,7 @@ const MIRNA_PINS_LIST = mirnasFixture.map(mirna => ({ const renderComponent = ( pinsList: PinItem[], - type: PinType, + type: PinTypeWithNone, initialStoreState: InitialStoreState = {}, ): { store: StoreType } => { const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState); diff --git a/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.test.tsx b/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.test.tsx index 2f6a4e50..17a3656c 100644 --- a/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.test.tsx +++ b/src/components/Map/Drawer/SearchDrawerWrapper/ResultsList/PinsList/PinsListItem/PinsListItem.component.test.tsx @@ -1,15 +1,15 @@ /* eslint-disable no-magic-numbers */ -import { render, screen } from '@testing-library/react'; +import { bioEntitiesContentFixture } from '@/models/fixtures/bioEntityContentsFixture'; +import { chemicalsFixture } from '@/models/fixtures/chemicalsFixture'; +import { drugsFixture } from '@/models/fixtures/drugFixtures'; +import { StoreType } from '@/redux/store'; +import { PinDetailsItem } from '@/types/models'; import { InitialStoreState, getReduxWrapperWithStore, } from '@/utils/testing/getReduxWrapperWithStore'; -import { drugsFixture } from '@/models/fixtures/drugFixtures'; -import { chemicalsFixture } from '@/models/fixtures/chemicalsFixture'; -import { bioEntitiesContentFixture } from '@/models/fixtures/bioEntityContentsFixture'; -import { StoreType } from '@/redux/store'; -import { PinDetailsItem } from '@/types/models'; -import { PinType } from '../PinsList.types'; +import { render, screen } from '@testing-library/react'; +import { PinTypeWithNone } from '../PinsList.types'; import { PinsListItem } from './PinsListItem.component'; const DRUGS_PIN = { @@ -25,7 +25,7 @@ const CHEMICALS_PIN = { const renderComponent = ( name: string, pin: PinDetailsItem, - type: PinType, + type: PinTypeWithNone, initialStoreState: InitialStoreState = {}, ): { store: StoreType } => { const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState); diff --git a/src/models/authorSchema.ts b/src/models/authorSchema.ts index 2dfa82ec..26e45553 100644 --- a/src/models/authorSchema.ts +++ b/src/models/authorSchema.ts @@ -1,3 +1,11 @@ import { z } from 'zod'; -export const authorSchema = z.string(); +export const authorSchema = z.union([ + z.string(), + z.object({ + firstName: z.string(), + lastName: z.string(), + email: z.string(), + organisation: z.string(), + }), +]); -- GitLab