fix(asset-ai): refine mobile viewport and operating query scope
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
shishengliang
2026-09-23 18:49:26 +08:00
parent 5be6240bbf
commit 6de77adb47
11 changed files with 145 additions and 23 deletions
@@ -50,6 +50,20 @@ test("permissions and company filters apply before aggregation and detail genera
["0"],
);
});
test("Shanghai counts include districts and preserve permission and company scope", () => {
const input = vehicles.map((v, index) => ({ ...v, province: "上海市", city: ["松江区", "嘉定区", "奉贤区", "上海市"][index] }));
const query = validatePlan({ ...plan, category: "all", groupBy: "city", filters: { city: ["上海市"] } });
const all = assetResult(input, query);
assert.equal(all.metrics[0].value, 4);
assert.equal(all.rows.length, 4);
assert.equal(all.groups.length, 1);
assert.equal(all.groups[0].count, 4);
const scoped = assetResult(visibleVehicles(input, user, "甲公司"), query);
assert.equal(scoped.metrics[0].value, 2);
assert.deepEqual(scoped.rows.map(v => v.id).sort(), ["0", "3"]);
assert.ok(scoped.rows.every(v => v.city === "上海市"));
});
test("inventory includes abnormal and pending; group totals reconcile with detail", () => {
const result = assetResult(vehicles, validatePlan(plan));
assert.equal(result.rows.length, 3);