fix(storybook): isolate project workspace queries

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Dotta 2026-09-08 08:40:49 -05:00
parent 0bed8c643d
commit bd4b566f96
2 changed files with 19 additions and 0 deletions

View File

@ -23,6 +23,17 @@ function operation(
}
describe("work-folder Storybook fixtures", () => {
it("handles the project page's workspace query without a backend", async () => {
const fixture = createWorkFolderFixture();
const response = await fixture.handle(
new Request(
"http://storybook.test/api/companies/company-storybook/execution-workspaces?projectId=project-board-ui",
),
);
expect(response!.status).toBe(200);
expect(await response!.json()).toEqual([]);
});
it("keeps uploads within one owner and resets them for the next story", async () => {
const fixture = createWorkFolderFixture("empty");
const bytes = new Uint8Array([0, 255, 128, 10]);

View File

@ -128,6 +128,14 @@ export function createWorkFolderFixture(
}
async function handle(request: Request): Promise<Response | null> {
const url = new URL(request.url);
// ProjectDetail loads this list even when its Files dialog is the review focus.
if (
request.method === "GET" &&
url.pathname ===
`/api/companies/${WORK_FOLDER_COMPANY}/execution-workspaces`
) {
return Response.json([]);
}
const match = url.pathname.match(
/^\/api\/companies\/company-storybook\/work-folders\/(task|agent|user|project)\/([^/]+)(?:\/(content|operations|sync|refresh))?$/,
);