fix: align stock and refill semantics

Squash merge PR #474
This commit is contained in:
Daniel Volz
2026-03-25 06:49:34 +01:00
committed by GitHub
parent 37fc2b8e66
commit 7059c25f1c
18 changed files with 1063 additions and 463 deletions
@@ -921,6 +921,39 @@ describe("MedDetailModal stock overflow warning", () => {
});
});
describe("MedDetailModal amount-based stock display", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("shows current liquid stock against configured structural capacity", () => {
const liquidMed: Medication = {
...mockMedication,
id: 20,
name: "Liquid Multi",
packageType: "liquid_container",
packCount: 4,
packageAmountValue: 150,
packageAmountUnit: "ml",
totalPills: 450,
looseTablets: 450,
};
const liquidCoverage: Coverage = {
name: "Liquid Multi",
medsLeft: 450,
daysLeft: 45,
depletionDate: "2024-04-01",
depletionTime: Date.now() + 45 * 86400000,
nextDose: null,
};
render(<MedDetailModal {...defaultProps} selectedMed={liquidMed} coverage={{ all: [liquidCoverage] }} />);
expect(screen.getByText("450 / 600 form.packageAmountUnitMl")).toBeInTheDocument();
expect(screen.queryByText("450 / 450 form.packageAmountUnitMl")).not.toBeInTheDocument();
});
});
describe("MedDetailModal bottle package type", () => {
const bottleMed: Medication = {
id: 2,