|
@@ -1,6 +1,7 @@
|
|
|
import { expect, test } from "bun:test"
|
|
import { expect, test } from "bun:test"
|
|
|
import { candidateImpact, nextReviewStep, reviewReport } from "../src/util/software-review-report"
|
|
import { candidateImpact, nextReviewStep, reviewReport } from "../src/util/software-review-report"
|
|
|
import type { Review, Evidence } from "../src/util/software-review"
|
|
import type { Review, Evidence } from "../src/util/software-review"
|
|
|
|
|
+import { businessText } from "../src/util/software-review-business"
|
|
|
|
|
|
|
|
const fixture = (): Review => ({
|
|
const fixture = (): Review => ({
|
|
|
id: "a".repeat(32),
|
|
id: "a".repeat(32),
|
|
@@ -33,6 +34,37 @@ const comparison = {
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+test("business review shows test bindings and exclusions before and after execution", () => {
|
|
|
|
|
+ const spec = { profile: "automotive", status: "incomplete", passed: false,
|
|
|
|
|
+ contracts: [{ category: "units_ranges", invariant: "Keep units", test_path: "Check.java", test_case: "Check#units",
|
|
|
|
|
+ quote: "assert speed == 36;", status: "unverified", reason: "Assertion did not match" }],
|
|
|
|
|
+ exclusions: [{ category: "variant_revision", reason: "No variant field in this fixture" }],
|
|
|
|
|
+ missing_categories: ["protocol_compatibility"] }
|
|
|
|
|
+ expect(businessText(spec, "plan")).toContain("断言:assert speed == 36;")
|
|
|
|
|
+ const state = fixture()
|
|
|
|
|
+ state.execution = { result: { business_acceptance: { baseline: spec, current: spec } } }
|
|
|
|
|
+ const report = reviewReport(state, 2)
|
|
|
|
|
+ for (const value of ["重构前 · 业务验收", "重构后 · 业务验收", "Check.java → Check#units", "Assertion did not match",
|
|
|
|
|
+ "排除 · 车型与版本", "缺项 · 协议兼容"]) expect(report).toContain(value)
|
|
|
|
|
+ expect(report).not.toContain("声明范围通过")
|
|
|
|
|
+ expect(businessText(undefined, "result")).toContain("尚未取得结果")
|
|
|
|
|
+ expect(businessText(undefined, "plan")).toContain("未声明")
|
|
|
|
|
+ expect(businessText({ status: "not_declared" }, "result")).toContain("未声明")
|
|
|
|
|
+ expect(businessText({ ...spec, contracts: [{ ...spec.contracts[0], executed_test_cases: ["actual::one", "actual::two"] }] }, "result"))
|
|
|
|
|
+ .toContain("已绑定 2 个实际执行用例")
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+test("ontology failure stays visible even when build and native tests pass", () => {
|
|
|
|
|
+ const state = fixture()
|
|
|
|
|
+ state.phase = "verification_failed"
|
|
|
|
|
+ const evidence: Evidence = { id: state.id, revision: state.revision, token: "t", files: [], checks: {
|
|
|
|
|
+ "round-1/checks.json": { passed: false, build_status: "passed", test_status: "passed",
|
|
|
|
|
+ ontology_error: "Declared rule target no longer resolves" },
|
|
|
|
|
+ } }
|
|
|
|
|
+ expect(reviewReport(state, 2, { evidence })).toContain("本体重建失败:Declared rule target no longer resolves")
|
|
|
|
|
+ expect(reviewReport(state, 3, { evidence })).toContain("本体重建问题")
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
test("reports residual extracted methods without upgrading a disappearing finding to success", () => {
|
|
test("reports residual extracted methods without upgrading a disappearing finding to success", () => {
|
|
|
const value = reviewReport(fixture(), 1, { comparison })
|
|
const value = reviewReport(fixture(), 1, { comparison })
|
|
|
expect(value).toContain("106 行")
|
|
expect(value).toContain("106 行")
|