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:
@@ -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();
|
||||
|
||||
@@ -60,11 +60,15 @@ export type InsightCategory =
|
||||
* generated → confirmed → stale
|
||||
* ↓
|
||||
* dismissed
|
||||
* ↕
|
||||
* archived
|
||||
*
|
||||
* A "stale" insight has been superseded or is no longer relevant.
|
||||
* A "dismissed" insight was manually rejected by a reviewer.
|
||||
* An "archived" insight was actioned or intentionally hidden, and can be
|
||||
* unarchived back to "confirmed".
|
||||
*/
|
||||
export type InsightStatus = "generated" | "confirmed" | "stale" | "dismissed";
|
||||
export type InsightStatus = "generated" | "confirmed" | "stale" | "dismissed" | "archived";
|
||||
|
||||
// ── Provenance Metadata ───────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user