updated tests to align with new logic

This commit is contained in:
Chris Sanden
2026-05-06 17:15:41 +02:00
parent f2312bce38
commit 419463e5be
11 changed files with 113 additions and 40 deletions

View File

@@ -102,10 +102,16 @@ test("deletes a subject and navigates back", async () => {
expect.any(Array),
);
const alertButtons = alertSpy.mock.calls[0][2];
const confirmDeleteButton = alertButtons[1];
const alertButtons = alertSpy.mock.calls[0]?.[2];
expect(alertButtons).toBeDefined();
const confirmDeleteButton = alertButtons?.[1];
expect(confirmDeleteButton?.onPress).toBeDefined();
await confirmDeleteButton.onPress();
if (!confirmDeleteButton?.onPress) {
throw new Error("Delete confirmation button missing");
}
await confirmDeleteButton.onPress();
await waitFor(() => {
expect(supabase.from).toHaveBeenCalledWith("subjects");