feat(story-193): clickable code references in frontend
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { MessageItem } from "./MessageItem";
|
||||
|
||||
vi.mock("../api/settings", () => ({
|
||||
settingsApi: {
|
||||
openFile: vi.fn(() => Promise.resolve({ success: true })),
|
||||
},
|
||||
}));
|
||||
|
||||
describe("MessageItem component (Story 178 AC3)", () => {
|
||||
it("renders user message as a bubble", () => {
|
||||
render(<MessageItem msg={{ role: "user", content: "Hello there!" }} />);
|
||||
@@ -72,6 +78,22 @@ describe("MessageItem component (Story 178 AC3)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("MessageItem code reference rendering (Story 193)", () => {
|
||||
it("renders inline code with a code reference as a clickable button in assistant messages", () => {
|
||||
render(
|
||||
<MessageItem
|
||||
msg={{
|
||||
role: "assistant",
|
||||
content: "Check `src/main.rs:42` for the implementation.",
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
const button = screen.getByRole("button", { name: /src\/main\.rs:42/ });
|
||||
expect(button).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("MessageItem user message code fence rendering (Story 196)", () => {
|
||||
it("renders code fences in user messages as code blocks", () => {
|
||||
const { container } = render(
|
||||
|
||||
Reference in New Issue
Block a user