Connect evidence-backed business model assessments to company categories

This commit is contained in:
2026-11-01 00:00:35 +08:00
parent c833aa56c1
commit 5b31fa5b77
7 changed files with 113 additions and 7 deletions
+7 -2
View File
@@ -8,7 +8,7 @@ import coverageAudit from "../../../content/research/ai-companies.coverage.json"
import incomeReference from "../../../content/research/ai-income-analysis.json";
import { readResearchSnapshot } from "../src/lib/ai-research-store";
import { openSiteDatabase } from "../src/lib/site-database";
import { categorySummary, evidenceUrl, reviewCompanyIds, validateResearch, type ResearchSnapshot } from "../src/lib/ai-research";
import { businessModelReviewType, 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 { arrDisclosureCoverage, arrDisclosures, arrFieldGaps, compareIncomeGroups, describeIncome, groupIncome, platformIncomeSample } from "../src/lib/research-statistics";
@@ -126,6 +126,11 @@ test("research revisions share the authentication database and preserve replay l
assert.equal(initial.companies.length, 1199);
assert.equal(initial.evidence.length, 4667);
assert.equal(initial.observations.length, 453);
const businessReviews = initial.reviews.filter((review) => review.type === businessModelReviewType);
assert.equal(businessReviews.length, 4);
assert.deepEqual(businessReviews, seed.reviews.filter((review) => review.type === businessModelReviewType)
.sort((a, b) => a.id.localeCompare(b.id)),
"business model assessments and company/evidence links persist in the shared database");
assert.deepEqual(initial.candidateBatches, seed.candidateBatches, "candidate gaps persist in the same database metadata");
assert.deepEqual(initial.directoryRechecks, seed.directoryRechecks, "follow-up classifications persist without rewriting the discovery audit");
assert.deepEqual(readResearchSnapshot(), initial, "reopening does not duplicate records");
@@ -164,7 +169,7 @@ test("research validation rejects broken evidence and unsafe source links", () =
test("reviews link explicit companies without turning global or excluded cases into companies", () => {
const snapshot = structuredClone(seed) as ResearchSnapshot;
assert.equal(snapshot.reviews.filter((r) => r.scope === "companies").length, 210);
assert.equal(snapshot.reviews.filter((r) => r.scope === "companies").length, 214);
assert.equal(snapshot.reviews.filter((r) => r.scope === "dataset").length, 143);
assert.equal(snapshot.reviews.filter((r) => r.scope === "excluded-candidate").length, 46);
const review = snapshot.reviews.find((r) => r.id === "R4")!;