diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index 4706712..12b3407 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -15,7 +15,11 @@ const Modal = (props: ModalProps) => { {props.header != null && (
{props.header}
)} -
+
diff --git a/src/pages/PassengersPage/components/PatientDetailsModal/__tests__/PatientDetailsModal.test.tsx b/src/pages/PassengersPage/components/PatientDetailsModal/__tests__/PatientDetailsModal.test.tsx new file mode 100644 index 0000000..5ccfd4c --- /dev/null +++ b/src/pages/PassengersPage/components/PatientDetailsModal/__tests__/PatientDetailsModal.test.tsx @@ -0,0 +1,32 @@ +import { createTestPassengerData } from "../../../../../util/test-data.util"; +import PatientDetailsModal from "../PatientDetailsModal"; +import { render, fireEvent } from "@testing-library/react"; + +describe("PatientDetailsModal", () => { + const mockOnClose = jest.fn(); + const mockPatient = createTestPassengerData(); + + it("renders patient details correctly", () => { + const { getByText } = render( + , + ); + + expect(getByText("Gender")).toBeTruthy(); + expect(getByText(mockPatient.fields.Gender)).toBeTruthy(); + expect(getByText("DOB")).toBeTruthy(); + expect( + getByText(mockPatient.fields["Date of Birth"].split("T")[0]), + ).toBeTruthy(); + // Add similar checks for other fields + }); + + it("calls onClose when the modal action is triggered", () => { + const component = render( + , + ); + + fireEvent.click(component.getByTestId("modal-close")); // Assuming the action triggers on a button click + + expect(mockOnClose).toHaveBeenCalled(); + }); +});