fix: bind knowledge maps to explicit regions
This commit is contained in:
1 parent
329a94d457
commit
90f75d41ae
15 files changed
+1126
-275
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
|
||||
const overviewSource = readFileSync(
|
||||
new URL("../src/panels/plaza/PlazaOverview.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const mapSource = readFileSync(
|
||||
new URL("../src/panels/plaza/SuperAgentPanel.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const projectLandingSource = readFileSync(
|
||||
new URL("../src/ProjectLanding.tsx", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
const regionsSource = readFileSync(
|
||||
new URL("../src/spatialMapRegions.ts", import.meta.url),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
test("every map-enabled project uses the single KnowledgeMap template", () => {
|
||||
assert.match(overviewSource, /isKnowledgeMapProject && \(/);
|
||||
assert.match(overviewSource, /<KnowledgeMap/);
|
||||
assert.doesNotMatch(overviewSource, /<SuperAgentPanel/);
|
||||
});
|
||||
|
||||
test("the shared map preserves the four approved shortcut logos and province summary", () => {
|
||||
assert.match(mapSource, /MAP_SHORTCUT_CATEGORIES = \["美食", "酒店", "景点", "交通设施"\]/);
|
||||
assert.match(mapSource, /MAP_SHORTCUT_CATEGORIES\.map/);
|
||||
assert.match(mapSource, /省域馆藏汇总/);
|
||||
assert.match(mapSource, /cov\?\.total \?\? regionPois\.length/);
|
||||
assert.match(mapSource, /当前已入藏知识 \/ POI 条目/);
|
||||
});
|
||||
|
||||
test("map-enabled project creation requires an explicit administrative region", () => {
|
||||
assert.match(projectLandingSource, /name="map_region_adcode"/);
|
||||
assert.match(projectLandingSource, /请选择地图区域/);
|
||||
assert.match(projectLandingSource, /spatialMapConfigForRegion/);
|
||||
assert.match(regionsSource, /adcode: "520100", name: "贵阳市"/);
|
||||
assert.match(regionsSource, /adcode: "522722", name: "荔波县"/);
|
||||
});
|
||||
Reference in new issue
Block a user