- Add reusable file path linkification utilities and FileBrowser context wiring across dashboard modals and log surfaces - Linkify task detail, review, workflow, chat, activity, agent, dev server, and settings sync outputs so workspace paths open in the file browser - Preserve inline code styling when wrapping detected paths and extend FileBrowserModal handling for linked navigation - Cover the new linking behavior with dashboard tests and add a changeset plus AGENTS guidance for the reusable pattern Fusion-Task-Id: FN-4227
27 lines
805 B
TypeScript
27 lines
805 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import { FileBrowserProvider, useFileBrowser } from "../FileBrowserContext";
|
|
|
|
function Probe() {
|
|
const fileBrowser = useFileBrowser();
|
|
return <div data-testid="probe">{fileBrowser ? "present" : "missing"}</div>;
|
|
}
|
|
|
|
describe("FileBrowserContext", () => {
|
|
it("returns null outside the provider", () => {
|
|
render(<Probe />);
|
|
expect(screen.getByTestId("probe")).toHaveTextContent("missing");
|
|
});
|
|
|
|
it("returns the provided value inside the provider", () => {
|
|
const openFile = vi.fn();
|
|
render(
|
|
<FileBrowserProvider openFile={openFile}>
|
|
<Probe />
|
|
</FileBrowserProvider>,
|
|
);
|
|
|
|
expect(screen.getByTestId("probe")).toHaveTextContent("present");
|
|
});
|
|
});
|