fix(test): align stage names with consolidated pipeline enum
Followup to 886119c (refactor(sales): consolidate pipeline stages) — the
runtime enum was renamed but a few test fixtures and PDF report templates
still referenced the legacy names, leaving them broken at the type level
(36 tsc errors before this fix).
Renames in this commit:
visited -> in_communication (alerts test) / removed (PDF reports)
signed_eoi_nda -> eoi_signed
contract -> contract_signed (interests test) / contract_sent (factory)
Affected files: pipeline-report, revenue-report, makeCreateInterestInput
factory, alerts-engine, pipeline-transitions, interest-scoring.
Verification: tsc clean, 858/858 vitest passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,10 +58,11 @@ export function buildPipelineInputs(
|
|||||||
'open',
|
'open',
|
||||||
'details_sent',
|
'details_sent',
|
||||||
'in_communication',
|
'in_communication',
|
||||||
'visited',
|
'eoi_sent',
|
||||||
'signed_eoi_nda',
|
'eoi_signed',
|
||||||
'deposit_10pct',
|
'deposit_10pct',
|
||||||
'contract',
|
'contract_sent',
|
||||||
|
'contract_signed',
|
||||||
'completed',
|
'completed',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -73,9 +74,7 @@ export function buildPipelineInputs(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Include stages not in standard order
|
// Include stages not in standard order
|
||||||
const unknownStages = Object.keys(data.stageCounts).filter(
|
const unknownStages = Object.keys(data.stageCounts).filter((s) => !stageOrder.includes(s));
|
||||||
(s) => !stageOrder.includes(s),
|
|
||||||
);
|
|
||||||
for (const stage of unknownStages) {
|
for (const stage of unknownStages) {
|
||||||
summaryLines.push(`${stage}: ${data.stageCounts[stage]} interest(s)`);
|
summaryLines.push(`${stage}: ${data.stageCounts[stage]} interest(s)`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,18 +50,16 @@ export const revenueReportTemplate: Template = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export function buildRevenueInputs(
|
export function buildRevenueInputs(data: RevenueData, portName?: string): Record<string, string>[] {
|
||||||
data: RevenueData,
|
|
||||||
portName?: string,
|
|
||||||
): Record<string, string>[] {
|
|
||||||
const stageOrder = [
|
const stageOrder = [
|
||||||
'open',
|
'open',
|
||||||
'details_sent',
|
'details_sent',
|
||||||
'in_communication',
|
'in_communication',
|
||||||
'visited',
|
'eoi_sent',
|
||||||
'signed_eoi_nda',
|
'eoi_signed',
|
||||||
'deposit_10pct',
|
'deposit_10pct',
|
||||||
'contract',
|
'contract_sent',
|
||||||
|
'contract_signed',
|
||||||
'completed',
|
'completed',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -635,10 +635,11 @@ export function makeCreateInterestInput(overrides?: {
|
|||||||
| 'open'
|
| 'open'
|
||||||
| 'details_sent'
|
| 'details_sent'
|
||||||
| 'in_communication'
|
| 'in_communication'
|
||||||
| 'visited'
|
| 'eoi_sent'
|
||||||
| 'signed_eoi_nda'
|
| 'eoi_signed'
|
||||||
| 'deposit_10pct'
|
| 'deposit_10pct'
|
||||||
| 'contract'
|
| 'contract_sent'
|
||||||
|
| 'contract_signed'
|
||||||
| 'completed';
|
| 'completed';
|
||||||
}) {
|
}) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ describe('alert engine', () => {
|
|||||||
await db.insert(interests).values({
|
await db.insert(interests).values({
|
||||||
portId: port.id,
|
portId: port.id,
|
||||||
clientId: client.id,
|
clientId: client.id,
|
||||||
pipelineStage: 'visited',
|
pipelineStage: 'in_communication',
|
||||||
leadCategory: 'hot_lead',
|
leadCategory: 'hot_lead',
|
||||||
dateLastContact: stale,
|
dateLastContact: stale,
|
||||||
updatedAt: stale,
|
updatedAt: stale,
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ describe('Pipeline Transitions', () => {
|
|||||||
await import('@/lib/services/interests.service');
|
await import('@/lib/services/interests.service');
|
||||||
const meta = makeAuditMeta({ portId });
|
const meta = makeAuditMeta({ portId });
|
||||||
|
|
||||||
await changeInterestStage(interestId, portId, { pipelineStage: 'signed_eoi_nda' }, meta);
|
await changeInterestStage(interestId, portId, { pipelineStage: 'eoi_signed' }, meta);
|
||||||
|
|
||||||
const updated = await getInterestById(interestId, portId);
|
const updated = await getInterestById(interestId, portId);
|
||||||
expect(updated.dateEoiSigned).not.toBeNull();
|
expect(updated.dateEoiSigned).not.toBeNull();
|
||||||
@@ -181,7 +181,7 @@ describe('Pipeline Transitions', () => {
|
|||||||
await import('@/lib/services/interests.service');
|
await import('@/lib/services/interests.service');
|
||||||
const meta = makeAuditMeta({ portId });
|
const meta = makeAuditMeta({ portId });
|
||||||
|
|
||||||
await changeInterestStage(interestId, portId, { pipelineStage: 'contract' }, meta);
|
await changeInterestStage(interestId, portId, { pipelineStage: 'contract_signed' }, meta);
|
||||||
|
|
||||||
const updated = await getInterestById(interestId, portId);
|
const updated = await getInterestById(interestId, portId);
|
||||||
expect(updated.dateContractSigned).not.toBeNull();
|
expect(updated.dateContractSigned).not.toBeNull();
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ describe('calculateInterestScore', () => {
|
|||||||
portId: 'p1',
|
portId: 'p1',
|
||||||
clientId: 'c1',
|
clientId: 'c1',
|
||||||
createdAt: daysAgo(10),
|
createdAt: daysAgo(10),
|
||||||
pipelineStage: 'contract',
|
pipelineStage: 'contract_signed',
|
||||||
eoiStatus: 'signed',
|
eoiStatus: 'signed',
|
||||||
contractStatus: 'signed',
|
contractStatus: 'signed',
|
||||||
depositStatus: 'received',
|
depositStatus: 'received',
|
||||||
|
|||||||
Reference in New Issue
Block a user