feat: show ARR disclosure coverage by business category
This commit is contained in:
@@ -11,7 +11,34 @@ import { openSiteDatabase } from "../src/lib/site-database";
|
||||
import { categorySummary, evidenceUrl, reviewCompanyIds, validateResearch, type ResearchSnapshot } from "../src/lib/ai-research";
|
||||
import { consumeCode, initializeStore } from "../src/lib/auth-store";
|
||||
import { newAuthConfig } from "../src/lib/auth";
|
||||
import { arrDisclosures, describeIncome, groupIncome, platformIncomeSample } from "../src/lib/research-statistics";
|
||||
import { arrDisclosureCoverage, arrDisclosures, describeIncome, groupIncome, platformIncomeSample } from "../src/lib/research-statistics";
|
||||
|
||||
test("ARR coverage counts companies once and separates missing disclosures from zero income", () => {
|
||||
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
||||
snapshot.categories = [{ id: "C07", name: "行业应用", description: "" }];
|
||||
const template = snapshot.companies[0];
|
||||
snapshot.companies = [
|
||||
{ ...template, id: "reported", cat: "C07", year: 2025 },
|
||||
{ ...template, id: "estimated", cat: "C07", year: 2026 },
|
||||
{ ...template, id: "missing", cat: "C07", year: 2025 },
|
||||
{ ...template, id: "old", cat: "C07", year: 2024 },
|
||||
{ ...template, id: "undated", cat: "C07", year: null },
|
||||
];
|
||||
const observation = snapshot.observations[0];
|
||||
snapshot.observations = [
|
||||
{ ...observation, id: "zero", company: "reported", metric: "arr", selection: "signal", value: 0 },
|
||||
{ ...observation, id: "past", company: "reported", metric: "arr", selection: "historical", value: 10 },
|
||||
{ ...observation, id: "estimate", company: "reported", metric: "arr", selection: "estimate", value: 20 },
|
||||
{ ...observation, id: "only-estimate", company: "estimated", metric: "arr", selection: "historical-estimate", value: 30 },
|
||||
{ ...observation, id: "goal", company: "missing", metric: "arr", selection: "excluded", value: 40 },
|
||||
{ ...observation, id: "mrr", company: "missing", metric: "mrr", selection: "platform", value: 50 },
|
||||
{ ...observation, id: "old-arr", company: "old", metric: "arr", selection: "signal", value: 60 },
|
||||
];
|
||||
assert.deepEqual(arrDisclosureCoverage(snapshot), [{ id: "C07", name: "行业应用",
|
||||
companies: 3, disclosed: 2, reported: 1, estimatedOnly: 1, missing: 1, records: 4 }]);
|
||||
assert.deepEqual(arrDisclosureCoverage(snapshot, 2025), [{ id: "C07", name: "行业应用",
|
||||
companies: 2, disclosed: 1, reported: 1, estimatedOnly: 0, missing: 1, records: 3 }]);
|
||||
});
|
||||
|
||||
test("ARR ledger preserves historical estimates without promoting targets, run rates or outside-cohort claims", () => {
|
||||
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
||||
|
||||
Reference in New Issue
Block a user