Chat.test.tsx 692 B

12345678910111213141516171819202122232425262728
  1. import { screen } from "@testing-library/react";
  2. import { describe, expect, it } from "vitest";
  3. import { renderWithProviders } from "test-utils";
  4. import Chat from "#/components/chat/Chat";
  5. const MESSAGES: Message[] = [
  6. {
  7. sender: "assistant",
  8. content: "Hello!",
  9. imageUrls: [],
  10. timestamp: new Date().toISOString(),
  11. },
  12. {
  13. sender: "user",
  14. content: "Hi!",
  15. imageUrls: [],
  16. timestamp: new Date().toISOString(),
  17. },
  18. ];
  19. describe("Chat", () => {
  20. it("should render chat messages", () => {
  21. renderWithProviders(<Chat messages={MESSAGES} />);
  22. const messages = screen.getAllByTestId("article");
  23. expect(messages).toHaveLength(MESSAGES.length);
  24. });
  25. });