增加按分类与成立年份浏览的 ARR 披露表
This commit is contained in:
@@ -11,7 +11,31 @@ 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 { describeIncome, groupIncome, platformIncomeSample } from "../src/lib/research-statistics";
|
||||
import { arrDisclosures, describeIncome, groupIncome, platformIncomeSample } from "../src/lib/research-statistics";
|
||||
|
||||
test("ARR ledger preserves historical estimates without promoting targets, run rates or outside-cohort claims", () => {
|
||||
const snapshot = structuredClone(seed) as ResearchSnapshot;
|
||||
const rows = arrDisclosures(snapshot);
|
||||
const ids = new Set(rows.map((row) => row.observation.id));
|
||||
for (const id of ["O064", "O065", "O066", "O069", "O070", "O071", "O046"])
|
||||
assert.ok(ids.has(id), `${id}: historical claims, estimates and unknown currencies remain visible`);
|
||||
for (const id of ["O050", "O052", "O053", "O055", "SR-O-AI067-runrate", "ROCKET-O-arr", "AQ-O-RUNRATE"])
|
||||
assert.ok(!ids.has(id), `${id}: excluded or ambiguous records cannot enter the ARR ledger`);
|
||||
assert.equal(rows.find((row) => row.observation.id === "O066")?.observation.selection, "historical-estimate");
|
||||
assert.equal(rows.find((row) => row.observation.id === "O046")?.observation.unit, "原文$,币种待核");
|
||||
const category = snapshot.companies.find((company) => company.id === "AI055")!.cat;
|
||||
const filtered = arrDisclosures(snapshot, { category, foundedYear: 2025 });
|
||||
assert.ok(filtered.length > 0);
|
||||
assert.ok(filtered.every((row) => row.company.cat === category && row.company.year === 2025));
|
||||
// A future mistakenly typed target still must not enter the ledger.
|
||||
const target = snapshot.observations.find((item) => item.id === "O052")!;
|
||||
target.metric = "arr";
|
||||
target.company = "AI055";
|
||||
assert.ok(!arrDisclosures(snapshot).some((row) => row.observation.id === target.id));
|
||||
const claim = snapshot.observations.find((item) => item.id === "O065")!;
|
||||
claim.value = Number.NaN;
|
||||
assert.ok(!arrDisclosures(snapshot).some((row) => row.observation.id === claim.id));
|
||||
});
|
||||
|
||||
test("research revisions share the authentication database and preserve replay limits", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "site-research-"));
|
||||
|
||||
Reference in New Issue
Block a user