From 9c529f68230b5b04864aa1cc518ba31cd5773c5f Mon Sep 17 00:00:00 2001 From: Usama Idriss Kakumba Date: Thu, 5 Dec 2024 08:51:18 +0300 Subject: [PATCH] fix: fix tests --- .../advanced-patient-search.test.tsx | 33 ++++++++----------- .../patient-search-page.test.tsx | 33 ++++++++----------- .../refine-search/refine-search.test.tsx | 32 ++++++++---------- .../refine-search/search-field.test.tsx | 23 ------------- 4 files changed, 39 insertions(+), 82 deletions(-) diff --git a/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.test.tsx b/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.test.tsx index 0a452fa4d..7fcce1f6e 100644 --- a/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.test.tsx +++ b/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.test.tsx @@ -65,29 +65,22 @@ describe('AdvancedPatientSearchComponent', () => { search: { disableTabletSearchOnKeyUp: false, showRecentlySearchedPatients: false, - searchFields: { - fields: { - gender: { - enabled: true, - label: 'Sex', - }, - dateOfBirth: { - enabled: true, - label: 'Date of Birth', - }, - age: { - enabled: true, - label: 'Age', - min: 0, - }, - postcode: { - enabled: true, - label: 'Postcode', - }, + searchFilterFields: { + gender: { + enabled: true, + }, + dateOfBirth: { + enabled: true, + }, + age: { + enabled: true, + min: 0, + }, + postcode: { + enabled: true, }, personAttributes: [ { - label: 'Phone Number', attributeTypeUuid: '14d4f066-15f5-102d-96e4-000c29c2a5d7', }, ], diff --git a/packages/esm-patient-search-app/src/patient-search-page/patient-search-page.test.tsx b/packages/esm-patient-search-app/src/patient-search-page/patient-search-page.test.tsx index a6298b69d..f6b03a611 100644 --- a/packages/esm-patient-search-app/src/patient-search-page/patient-search-page.test.tsx +++ b/packages/esm-patient-search-app/src/patient-search-page/patient-search-page.test.tsx @@ -27,29 +27,22 @@ describe('PatientSearchPageComponent', () => { search: { disableTabletSearchOnKeyUp: false, showRecentlySearchedPatients: false, - searchFields: { - fields: { - gender: { - enabled: true, - label: 'Sex', - }, - dateOfBirth: { - enabled: true, - label: 'Date of Birth', - }, - age: { - enabled: true, - label: 'Age', - min: 0, - }, - postcode: { - enabled: true, - label: 'Postcode', - }, + searchFilterFields: { + gender: { + enabled: true, + }, + dateOfBirth: { + enabled: true, + }, + age: { + enabled: true, + min: 0, + }, + postcode: { + enabled: true, }, personAttributes: [ { - label: 'Phone Number', attributeTypeUuid: '14d4f066-15f5-102d-96e4-000c29c2a5d7', }, ], diff --git a/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.test.tsx b/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.test.tsx index 37b72a1fc..17d7660a0 100644 --- a/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.test.tsx +++ b/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.test.tsx @@ -20,25 +20,19 @@ describe('RefineSearch', () => { const mockSetFilters = jest.fn(); const mockConfig = { search: { - searchFields: { - fields: { - gender: { - enabled: true, - label: 'Sex', - }, - dateOfBirth: { - enabled: true, - label: 'Date of Birth', - }, - age: { - enabled: true, - label: 'Age', - min: 0, - }, - postcode: { - enabled: true, - label: 'Postcode', - }, + searchFilterFields: { + gender: { + enabled: true, + }, + dateOfBirth: { + enabled: true, + }, + age: { + enabled: true, + min: 0, + }, + postcode: { + enabled: true, }, personAttributes: [ { diff --git a/packages/esm-patient-search-app/src/patient-search-page/refine-search/search-field.test.tsx b/packages/esm-patient-search-app/src/patient-search-page/refine-search/search-field.test.tsx index 7b19d5e9d..cfe6578c5 100644 --- a/packages/esm-patient-search-app/src/patient-search-page/refine-search/search-field.test.tsx +++ b/packages/esm-patient-search-app/src/patient-search-page/refine-search/search-field.test.tsx @@ -70,7 +70,6 @@ describe('SearchField', () => { const genderField: SearchFieldConfig = { name: 'gender', type: 'gender', - label: 'Sex', }; it('renders all gender options', () => { @@ -94,7 +93,6 @@ describe('SearchField', () => { const dobField: SearchFieldConfig = { name: 'dateOfBirth', type: 'dateOfBirth', - label: 'Date of Birth', }; it('renders three number inputs for day, month, and year', () => { @@ -125,7 +123,6 @@ describe('SearchField', () => { const ageField: SearchFieldConfig = { name: 'age', type: 'age', - label: 'Age', min: 0, max: 120, }; @@ -139,22 +136,12 @@ describe('SearchField', () => { expect(ageInput).toHaveAttribute('min', '0'); expect(ageInput).toHaveAttribute('max', '120'); }); - - it('uses custom label when provided', () => { - const customAgeField = { - ...ageField, - label: 'Custom Age Label', - }; - render(); - expect(screen.getByLabelText('Custom Age Label')).toBeInTheDocument(); - }); }); describe('Postcode field', () => { const postcodeField: SearchFieldConfig = { name: 'postcode', type: 'postcode', - label: 'Postcode', placeholder: 'Enter postcode', }; @@ -164,15 +151,6 @@ describe('SearchField', () => { expect(input).toBeInTheDocument(); expect(input).toHaveAttribute('type', 'text'); }); - - it('uses custom label when provided', () => { - const customPostcodeField = { - ...postcodeField, - label: 'ZIP Code', - }; - render(); - expect(screen.getByLabelText('ZIP Code')).toBeInTheDocument(); - }); }); describe('Person Attribute field', () => { @@ -204,7 +182,6 @@ describe('SearchField', () => { const ageField: SearchFieldConfig = { name: 'age', type: 'age', - label: 'Age', }; it('applies tablet styles when in tablet mode', () => {