mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-07-27 22:45:03 +00:00
Classify by design-document presence through the whole pipeline 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0acc9f5211
commit
939cfcbee5
1 changed files with 41 additions and 0 deletions
|
|
@ -385,6 +385,15 @@ describe("resolveDisplayStage — after-coordination precedence (downstream evid
|
|||
)
|
||||
).toBe("At Post Survey");
|
||||
});
|
||||
|
||||
it("does NOT return Installation in Progress for designStatus UPLOADED when the design document is absent (regression for the reported bug)", () => {
|
||||
// The HubSpot designStatus flag can be set before — or without — the
|
||||
// Retrofit Design Document ever being uploaded. It must no longer push a
|
||||
// Property into Installation in Progress.
|
||||
expect(
|
||||
resolveDisplayStage(makeCoordinationCompleteDeal({ designStatus: "UPLOADED" }), false)
|
||||
).toBe("Design in Progress");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveDisplayStage — design-document presence drives the Design/Installation boundary", () => {
|
||||
|
|
@ -435,6 +444,19 @@ describe("classifyDeals", () => {
|
|||
expect(result.dealId).toBe("abc-123");
|
||||
expect(result.dealname).toBe("Test");
|
||||
});
|
||||
|
||||
it("classifies a coordination-complete deal as Installation in Progress only when its id is in the design-document set", () => {
|
||||
// Arrange
|
||||
const withDoc = makeDeal({ dealId: "has-doc", coordinationStatus: "(V1) IOE/MTP COMPLETE" });
|
||||
const withoutDoc = makeDeal({ dealId: "no-doc", coordinationStatus: "(V1) IOE/MTP COMPLETE" });
|
||||
|
||||
// Act
|
||||
const [a, b] = classifyDeals([withDoc, withoutDoc], new Set(["has-doc"]));
|
||||
|
||||
// Assert
|
||||
expect(a.displayStage).toBe("Installation in Progress");
|
||||
expect(b.displayStage).toBe("Design in Progress");
|
||||
});
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
@ -701,6 +723,25 @@ describe("computeLiveTrackerData", () => {
|
|||
expect(result.projects).toHaveLength(0);
|
||||
expect(result.totalDeals).toBe(0);
|
||||
});
|
||||
|
||||
it("reflects design-document presence in the project roll-up stage counts", () => {
|
||||
// Arrange — two coordination-complete deals in one project, one with a
|
||||
// Retrofit Design Document and one without.
|
||||
const deals = [
|
||||
makeDeal({ projectCode: "PROJ-A", dealId: "has-doc", coordinationStatus: "(V1) IOE/MTP COMPLETE" }),
|
||||
makeDeal({ projectCode: "PROJ-A", dealId: "no-doc", coordinationStatus: "(V1) IOE/MTP COMPLETE" }),
|
||||
];
|
||||
|
||||
// Act
|
||||
const result = computeLiveTrackerData(deals, new Set(["has-doc"]));
|
||||
|
||||
// Assert
|
||||
const stageProgress = result.projects[0].progress.stageProgress;
|
||||
const design = stageProgress.find((s) => s.stage === "Design in Progress")!;
|
||||
const install = stageProgress.find((s) => s.stage === "Installation in Progress")!;
|
||||
expect(design.count).toBe(1);
|
||||
expect(install.count).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasMajorConditionIssue", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue