-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21b79f1
commit 1ba3a62
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ages/PassengersPage/components/PatientDetailsModal/__tests__/PatientDetailsModal.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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( | ||
<PatientDetailsModal patient={mockPatient} onClose={mockOnClose} />, | ||
); | ||
|
||
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( | ||
<PatientDetailsModal patient={mockPatient} onClose={mockOnClose} />, | ||
); | ||
|
||
fireEvent.click(component.getByTestId("modal-close")); // Assuming the action triggers on a button click | ||
|
||
expect(mockOnClose).toHaveBeenCalled(); | ||
}); | ||
}); |