feat(FN-3315): add test coverage for archived insights in three test suites

Adds test coverage for archived insights across the core store, `InsightsView` component, and `useInsights` hook — 156 lines of new tests covering FN-3315.

Fusion-Task-Id: FN-3315
This commit is contained in:
Fusion
2026-05-04 23:18:10 -07:00
committed by gsxdsm
parent d699797606
commit b45b4dd17a
10 changed files with 475 additions and 53 deletions

View File

@@ -173,10 +173,15 @@ describe("InsightStore", () => {
it("filters by status", () => {
store.createInsight("proj", { title: "A", category: "quality", status: "confirmed", provenance: createProvenance() });
store.createInsight("proj", { title: "B", category: "quality", status: "generated", provenance: createProvenance() });
store.createInsight("proj", { title: "C", category: "quality", status: "archived", provenance: createProvenance() });
const list = store.listInsights({ projectId: "proj", status: "confirmed" });
expect(list).toHaveLength(1);
expect(list[0].title).toBe("A");
const archived = store.listInsights({ projectId: "proj", status: "archived" });
expect(archived).toHaveLength(1);
expect(archived[0].title).toBe("C");
});
it("supports pagination with limit and offset", () => {
@@ -250,6 +255,18 @@ describe("InsightStore", () => {
expect(updated!.updatedAt >= original.createdAt).toBe(true);
});
it("updates status to archived", () => {
const original = store.createInsight("proj", {
title: "Archive me",
category: "quality",
status: "confirmed",
provenance: createProvenance(),
});
const updated = store.updateInsight(original.id, { status: "archived" });
expect(updated?.status).toBe("archived");
});
it("returns undefined for non-existent insight", () => {
const result = store.updateInsight("INS-NOTFOUND", { title: "X" });
expect(result).toBeUndefined();