Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaidrsk committed Dec 5, 2024
1 parent 44a7fb4 commit 9c529f6
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ describe('SearchField', () => {
const genderField: SearchFieldConfig = {
name: 'gender',
type: 'gender',
label: 'Sex',
};

it('renders all gender options', () => {
Expand All @@ -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', () => {
Expand Down Expand Up @@ -125,7 +123,6 @@ describe('SearchField', () => {
const ageField: SearchFieldConfig = {
name: 'age',
type: 'age',
label: 'Age',
min: 0,
max: 120,
};
Expand All @@ -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(<SearchField field={customAgeField} {...defaultProps} />);
expect(screen.getByLabelText('Custom Age Label')).toBeInTheDocument();
});
});

describe('Postcode field', () => {
const postcodeField: SearchFieldConfig = {
name: 'postcode',
type: 'postcode',
label: 'Postcode',
placeholder: 'Enter postcode',
};

Expand All @@ -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(<SearchField field={customPostcodeField} {...defaultProps} />);
expect(screen.getByLabelText('ZIP Code')).toBeInTheDocument();
});
});

describe('Person Attribute field', () => {
Expand Down Expand Up @@ -204,7 +182,6 @@ describe('SearchField', () => {
const ageField: SearchFieldConfig = {
name: 'age',
type: 'age',
label: 'Age',
};

it('applies tablet styles when in tablet mode', () => {
Expand Down

0 comments on commit 9c529f6

Please sign in to comment.