Add DEB ensemble confidence signal

This commit is contained in:
2569718930@qq.com
2026-06-25 02:49:12 +08:00
parent 578f547fa7
commit ac565c4a00
7 changed files with 308 additions and 7 deletions
@@ -1,4 +1,10 @@
import { __buildDebQualityLabelForTest, __buildTemperatureStatsLabelsForTest } from "@/components/dashboard/scan-terminal/TemperatureStatsBars";
import {
__buildDebEnsembleLabelForTest,
__buildDebQualityClassForTest,
__buildDebQualityLabelForTest,
__buildDebQualityTitleForTest,
__buildTemperatureStatsLabelsForTest,
} from "@/components/dashboard/scan-terminal/TemperatureStatsBars";
import { temp } from "@/components/dashboard/scan-terminal/utils";
function assert(condition: unknown, message: string) {
@@ -71,4 +77,35 @@ export function runTests() {
__buildDebQualityLabelForTest({ recommendation: "insufficient" }, false) === "样本少",
"thin-sample DEB should render a Chinese low-sample label",
);
const supportingSignal = {
available: true,
stance: "supporting",
label_zh: "集合支撑",
label_en: "Ensemble support",
reason_zh: "集合区间较窄",
reason_en: "Ensemble spread is tight",
};
assert(
__buildDebEnsembleLabelForTest(supportingSignal, false) === "集+",
"supporting ensemble signal should render a compact Chinese marker",
);
assert(
__buildDebEnsembleLabelForTest({ ...supportingSignal, stance: "caution" }, true) === "Ens!",
"caution ensemble signal should render a compact English marker",
);
assert(
__buildDebQualityClassForTest({
recommendation: "primary",
quality_tier: "high",
ensemble_signal: { ...supportingSignal, stance: "caution" },
}).includes("amber"),
"ensemble caution should override the DEB quality badge color",
);
assert(
__buildDebQualityTitleForTest(
{ recommendation: "primary", ensemble_signal: supportingSignal },
false,
).includes("集合支撑"),
"DEB badge title should include the ensemble signal reason",
);
}