ConfirmationButtons.test.tsx 1016 B

1234567891011121314151617181920212223242526
  1. import { describe, expect, it, vi } from "vitest";
  2. import { userEvent } from "@testing-library/user-event";
  3. import { render, screen } from "@testing-library/react";
  4. import AgentState from "#/types/AgentState";
  5. import { changeAgentState } from "#/services/agentStateService";
  6. import ConfirmationButtons from "#/components/chat/ConfirmationButtons";
  7. describe("ConfirmationButtons", () => {
  8. vi.mock("#/services/agentStateService", () => ({
  9. changeAgentState: vi.fn(),
  10. }));
  11. it.skip("should change agent state appropriately on button click", async () => {
  12. const user = userEvent.setup();
  13. render(<ConfirmationButtons />);
  14. const confirmButton = screen.getByTestId("action-confirm-button");
  15. const rejectButton = screen.getByTestId("action-reject-button");
  16. await user.click(confirmButton);
  17. expect(changeAgentState).toHaveBeenCalledWith(AgentState.USER_CONFIRMED);
  18. await user.click(rejectButton);
  19. expect(changeAgentState).toHaveBeenCalledWith(AgentState.USER_REJECTED);
  20. });
  21. });