Removing a project's AWS resources now deletes its secret with ForceDeleteWithoutRecovery (R10) so the next start can create it again, and the EFS option is renamed: it removes the access point, while the files stay on the user's own file system until offboarding (R9). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
2.0 KiB
TypeScript
46 lines
2.0 KiB
TypeScript
import { describe, it, expect, vi } from "vitest";
|
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
import ConfirmRemoveModal, { ConfirmForgetAwsModal } from "./ConfirmRemoveModal";
|
|
|
|
describe("ConfirmRemoveModal", () => {
|
|
it("keeps an AWS workspace's access point unless asked", () => {
|
|
const onConfirm = vi.fn();
|
|
render(<ConfirmRemoveModal projectName="api" aws savedFiles onConfirm={onConfirm} onCancel={vi.fn()} />);
|
|
const box = screen.getByRole("checkbox", { name: /file-system access point/ });
|
|
expect(box).not.toBeChecked();
|
|
fireEvent.click(screen.getByRole("button", { name: "Remove" }));
|
|
fireEvent.click(box);
|
|
fireEvent.click(screen.getByRole("button", { name: "Remove" }));
|
|
expect(onConfirm.mock.calls).toEqual([[{ discardData: false }], [{ discardData: true }]]);
|
|
});
|
|
|
|
it("offers no access-point choice for an Ephemeral AWS workspace", () => {
|
|
const onConfirm = vi.fn();
|
|
render(<ConfirmRemoveModal projectName="api" aws onConfirm={onConfirm} onCancel={vi.fn()} />);
|
|
expect(screen.queryByRole("checkbox")).toBeNull();
|
|
fireEvent.click(screen.getByRole("button", { name: "Remove" }));
|
|
expect(onConfirm).toHaveBeenCalledWith({ discardData: false });
|
|
});
|
|
|
|
it("offers no access-point choice for a local project", () => {
|
|
render(<ConfirmRemoveModal projectName="api" onConfirm={vi.fn()} onCancel={vi.fn()} />);
|
|
expect(screen.queryByRole("checkbox")).toBeNull();
|
|
expect(screen.getByText(/mounted in, not copied/)).toBeInTheDocument();
|
|
});
|
|
|
|
it("says what is left in AWS when the connection is gone", () => {
|
|
const onConfirm = vi.fn();
|
|
render(
|
|
<ConfirmForgetAwsModal
|
|
projectName="api"
|
|
reason="This project's AWS connection no longer exists"
|
|
onConfirm={onConfirm}
|
|
onCancel={vi.fn()}
|
|
/>,
|
|
);
|
|
expect(screen.getByText(/task definitions, its secret and its saved files/)).toBeInTheDocument();
|
|
fireEvent.click(screen.getByRole("button", { name: "Remove and leave them in AWS" }));
|
|
expect(onConfirm).toHaveBeenCalled();
|
|
});
|
|
});
|