Spaces:
Configuration error
Configuration error
Download frontend/__tests__/components/file-operations.test.tsx from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 2.81 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/__tests__/components/file-operations.test.tsx
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/__tests__/components/file-operations.test.tsx
-
curl -L -o file-operations.test.tsx https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/__tests__/components/file-operations.test.tsx
2.81 kB
| import { render, screen } from "@testing-library/react"; | |
| import { describe, it, expect } from "vitest"; | |
| import { Messages } from "#/components/features/chat/messages"; | |
| import type { Message } from "#/message"; | |
| import { renderWithProviders } from "test-utils"; | |
| describe("File Operations Messages", () => { | |
| it("should show success indicator for successful file read operation", () => { | |
| const messages: Message[] = [ | |
| { | |
| type: "action", | |
| translationID: "read_file_contents", | |
| content: "Successfully read file contents", | |
| success: true, | |
| sender: "assistant", | |
| timestamp: new Date().toISOString(), | |
| }, | |
| ]; | |
| renderWithProviders(<Messages messages={messages} isAwaitingUserConfirmation={false} />); | |
| const statusIcon = screen.getByTestId("status-icon"); | |
| expect(statusIcon).toBeInTheDocument(); | |
| expect(statusIcon.closest("svg")).toHaveClass("fill-success"); | |
| }); | |
| it("should show failure indicator for failed file read operation", () => { | |
| const messages: Message[] = [ | |
| { | |
| type: "action", | |
| translationID: "read_file_contents", | |
| content: "Failed to read file contents", | |
| success: false, | |
| sender: "assistant", | |
| timestamp: new Date().toISOString(), | |
| }, | |
| ]; | |
| renderWithProviders(<Messages messages={messages} isAwaitingUserConfirmation={false} />); | |
| const statusIcon = screen.getByTestId("status-icon"); | |
| expect(statusIcon).toBeInTheDocument(); | |
| expect(statusIcon.closest("svg")).toHaveClass("fill-danger"); | |
| }); | |
| it("should show success indicator for successful file edit operation", () => { | |
| const messages: Message[] = [ | |
| { | |
| type: "action", | |
| translationID: "edit_file_contents", | |
| content: "Successfully edited file contents", | |
| success: true, | |
| sender: "assistant", | |
| timestamp: new Date().toISOString(), | |
| }, | |
| ]; | |
| renderWithProviders(<Messages messages={messages} isAwaitingUserConfirmation={false} />); | |
| const statusIcon = screen.getByTestId("status-icon"); | |
| expect(statusIcon).toBeInTheDocument(); | |
| expect(statusIcon.closest("svg")).toHaveClass("fill-success"); | |
| }); | |
| it("should show failure indicator for failed file edit operation", () => { | |
| const messages: Message[] = [ | |
| { | |
| type: "action", | |
| translationID: "edit_file_contents", | |
| content: "Failed to edit file contents", | |
| success: false, | |
| sender: "assistant", | |
| timestamp: new Date().toISOString(), | |
| }, | |
| ]; | |
| renderWithProviders(<Messages messages={messages} isAwaitingUserConfirmation={false} />); | |
| const statusIcon = screen.getByTestId("status-icon"); | |
| expect(statusIcon).toBeInTheDocument(); | |
| expect(statusIcon.closest("svg")).toHaveClass("fill-danger"); | |
| }); | |
| }); | |