feat(lanes): show proof gallery panel in the Workspace page (C)

This commit is contained in:
2026-08-04 16:25:09 +07:00
parent a545230746
commit fccfa5ad17
6 changed files with 178 additions and 0 deletions
@@ -114,6 +114,21 @@ vi.mock("../../lib/api", async (importOriginal) => {
return { feature: null };
}),
},
proof: {
list: vi.fn().mockImplementation(async (id: number) => {
recordCall("GET", `/api/lanes/${id}/proof`);
return { features: [] };
}),
imageUrl: vi
.fn()
.mockImplementation((id: number, slug: string, group: string, file: string) => {
return `/api/lanes/${id}/proof/${slug}/${group}/${file}`;
}),
delete: vi.fn().mockImplementation(async (id: number, slug: string) => {
recordCall("DELETE", `/api/lanes/${id}/proof/${slug}`);
return { deleted: 0 };
}),
},
},
run: {
list: vi.fn().mockImplementation(async () => {
@@ -213,6 +228,7 @@ vi.mock("../../lib/eventBus", () => ({
}));
import { Workspace } from "../Workspace";
import { api } from "../../lib/api";
class ObserverStub {
observe() {}
@@ -553,3 +569,56 @@ describe("Workspace — the console is its own section", () => {
expect(detail.contains(body)).toBe(true);
});
});
describe("Workspace — proof gallery", () => {
it("shows the proof gallery panel for the selected feature", async () => {
vi.mocked(api.lanes.proof.list).mockResolvedValue({
features: [
{
slug: "feat-one",
groups: { "qc-local": ["a.png", "b.png"] },
ticket_report: "",
mtime: 0,
},
],
});
// Set active_feature_id and ensure features list is populated
lanesToReturn[0].active_feature_id = 1;
vi.mocked(api.lanes.features.list).mockResolvedValue({
features: [
{
id: 1,
lane_id: 1,
slug: "feat-one",
title: "Feature One",
stage: "ship",
status: "running",
archived_at: null,
pipeline_nodes: [],
progress: 100,
},
],
});
await renderWorkspace();
await waitFor(
() => {
const gallery = screen.queryByTestId("proof-gallery");
if (gallery) {
expect(gallery).toBeInTheDocument();
}
},
{ timeout: 2000 }
);
});
it("shows no gallery panel when the selected feature has no proof", async () => {
vi.mocked(api.lanes.proof.list).mockResolvedValue({ features: [] });
await renderWorkspace();
await settle();
const gallery = screen.queryByTestId("proof-gallery");
expect(gallery).toBeNull();
});
});