feat: track number of prescription repeats (#193)

* feat: track prescription repeats and refill reminders

* test: align backend and frontend suites with current prescription and UI behavior

* test: update frontend and backend expectations for latest reminders and refill flow
This commit is contained in:
Daniel Volz
2026-02-14 19:07:36 +01:00
committed by GitHub
parent edf42bb068
commit 8273b07231
37 changed files with 3331 additions and 4673 deletions
@@ -144,6 +144,36 @@ describe("MedDetailModal", () => {
expect(screen.getByText("Test notes")).toBeInTheDocument();
});
it("shows prescription details section when prescription is enabled", () => {
const med: Medication = {
...mockMedication,
prescriptionEnabled: true,
prescriptionAuthorizedRefills: 5,
prescriptionRemainingRefills: 2,
prescriptionLowRefillThreshold: 1,
prescriptionExpiryDate: "2026-12-31",
};
render(<MedDetailModal {...defaultProps} selectedMed={med} />);
expect(screen.getByText(/form\.sections\.prescription/i)).toBeInTheDocument();
expect(screen.getByText(/prescription\.authorizedRefills/i)).toBeInTheDocument();
expect(screen.getByText(/prescription\.remainingRefills/i)).toBeInTheDocument();
expect(screen.getByText(/prescription\.lowThreshold/i)).toBeInTheDocument();
expect(screen.getByText(/prescription\.expiryDate/i)).toBeInTheDocument();
});
it("does not show prescription details section when prescription is disabled", () => {
const med: Medication = {
...mockMedication,
prescriptionEnabled: false,
};
render(<MedDetailModal {...defaultProps} selectedMed={med} />);
expect(screen.queryByText(/form\.sections\.prescription/i)).not.toBeInTheDocument();
});
it("displays schedule information", () => {
render(<MedDetailModal {...defaultProps} />);
@@ -247,7 +277,7 @@ describe("MedDetailModal with refill modal", () => {
const submitBtn = document.querySelector(".refill-modal .modal-footer .success") as HTMLButtonElement;
fireEvent.click(submitBtn);
expect(onSubmitRefill).toHaveBeenCalledWith(mockMedication.id);
expect(onSubmitRefill).toHaveBeenCalledWith(mockMedication.id, undefined);
});
it("disables refill submit button when no pills are entered", () => {