feat(FN-2192): rename markdown files route to markdown-list
- Rename the dashboard markdown files route to /files/markdown-list. - Update fetchProjectMarkdownFiles to call the new markdown-list endpoint. - Adjust useDocuments test mocks and assertions to match the renamed route.
This commit is contained in:
@@ -776,7 +776,7 @@ export async function fetchAllDocuments(
|
||||
}
|
||||
|
||||
export function fetchProjectMarkdownFiles(projectId?: string): Promise<MarkdownFileListResponse> {
|
||||
return api<MarkdownFileListResponse>(withProjectId("/files/markdown", projectId));
|
||||
return api<MarkdownFileListResponse>(withProjectId("/files/markdown-list", projectId));
|
||||
}
|
||||
|
||||
export function putTaskDocument(
|
||||
|
||||
@@ -32,7 +32,7 @@ function createDocumentsFetchMock(options: {
|
||||
return vi.fn().mockImplementation((input: RequestInfo | URL) => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
||||
|
||||
if (url.includes("/files/markdown")) {
|
||||
if (url.includes("/files/markdown-list")) {
|
||||
if (options.failProjectFiles) {
|
||||
return mockFetchResponse(false, { error: "Project files failed" }, 500);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ describe("useDocuments", () => {
|
||||
await waitFor(() => {
|
||||
const urls = globalThis.fetch.mock.calls.map((call) => String(call[0]));
|
||||
expect(urls.some((url) => url.includes("/documents?q=readme"))).toBe(true);
|
||||
expect(urls.some((url) => url.includes("/files/markdown") && !url.includes("q=readme"))).toBe(true);
|
||||
expect(urls.some((url) => url.includes("/files/markdown-list") && !url.includes("q=readme"))).toBe(true);
|
||||
expect(urls.some((url) => url.includes("/project-files/md"))).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -218,7 +218,7 @@ describe("useDocuments", () => {
|
||||
await waitFor(() => {
|
||||
const urls = globalThis.fetch.mock.calls.map((call) => String(call[0]));
|
||||
expect(urls.some((url) => url.includes("/documents") && url.includes("projectId=proj-123"))).toBe(true);
|
||||
expect(urls.some((url) => url.includes("/files/markdown") && url.includes("projectId=proj-123"))).toBe(true);
|
||||
expect(urls.some((url) => url.includes("/files/markdown-list") && url.includes("projectId=proj-123"))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user