puerto 0.14.0

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly puerto-framework.
import { describe, expect, mock, test } from "bun:test";
import { fireEvent, render, screen } from "@testing-library/react";
import { ConfirmDialog } from "./confirm-dialog";

describe("ConfirmDialog", () => {
  test("should confirm when the confirm button is pressed", () => {
    // Arrange
    const onConfirm = mock(() => {});
    const onCancel = mock(() => {});
    render(
      <ConfirmDialog open message="Delete Alice?" onConfirm={onConfirm} onCancel={onCancel} />,
    );

    // Act
    fireEvent.click(screen.getByText("Delete"));

    // Assert
    expect(onConfirm).toHaveBeenCalledTimes(1);
    expect(onCancel).not.toHaveBeenCalled();
  });

  test("should cancel when the cancel button is pressed", () => {
    // Arrange
    const onConfirm = mock(() => {});
    const onCancel = mock(() => {});
    render(
      <ConfirmDialog open message="Delete Alice?" onConfirm={onConfirm} onCancel={onCancel} />,
    );

    // Act
    fireEvent.click(screen.getByText("Cancel"));

    // Assert
    expect(onCancel).toHaveBeenCalledTimes(1);
    expect(onConfirm).not.toHaveBeenCalled();
  });
});