Cleanup pass 2

This commit is contained in:
adilallo
2026-05-22 13:30:47 -06:00
parent b7c804bac8
commit 753220f97b
76 changed files with 1338 additions and 1020 deletions
+12 -10
View File
@@ -1,5 +1,5 @@
import { useEffect, useLayoutEffect } from "react";
import { describe, it, expect, vi } from "vitest";
import { describe, it, expect } from "vitest";
import { fireEvent, within } from "@testing-library/react";
import {
renderWithProviders as render,
@@ -11,6 +11,12 @@ import { FinalReviewScreen } from "../../app/(app)/create/screens/review/FinalRe
import { useCreateFlow } from "../../app/(app)/create/context/CreateFlowContext";
import type { CreateFlowState } from "../../app/(app)/create/types";
async function confirmDiscardCustomizeEdits() {
fireEvent.click(
await screen.findByRole("button", { name: "Discard" }),
);
}
/**
* Mounts the screen with a Customize-style preset selection and exposes the
* latest `state` to the test via `onState`. Used by the edit-modal save
@@ -521,15 +527,11 @@ describe("FinalReviewScreen — chip edit modal save semantics", () => {
target: { value: "Should NOT persist" },
});
const confirmSpy = vi.spyOn(window, "confirm").mockReturnValue(true);
try {
fireEvent.keyDown(document, { key: "Escape" });
await waitFor(() => {
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
});
} finally {
confirmSpy.mockRestore();
}
fireEvent.keyDown(document, { key: "Escape" });
await confirmDiscardCustomizeEdits();
await waitFor(() => {
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
});
expect(latest.communicationMethodDetailsById).toBeUndefined();
});