check:selection-kinds: resolve REAL tapped features, not hand-made keys
The gate began from keys like 'adm0:IND', so it never ran resolveTerritory on what the map hands the click handler, and it passed while every tapped country resolved as a province. Section 4 feeds the resolver three real tapestry shapes: a country (shapeName + iso3, no listId), an India state (listId + shapeName + iso3), and a country drawn inside an Asia zone (zone.adm0). Two-sided: on the previous resolver it fails three ways (Sudan and Nepal filed adm1 with null counts); on the fixed one it passes.
This commit is contained in:
parent
08dc0bdbe2
commit
757779d519
1 changed files with 21 additions and 0 deletions
|
|
@ -166,6 +166,27 @@ for (const fn of ['onLegendExport', 'makeSelectionPacket', 'makeSelectionPoster'
|
|||
}
|
||||
}
|
||||
|
||||
// ── 4. A TAPPED FEATURE RESOLVES AT ITS REAL LEVEL, FROM ITS REAL PROPERTIES ──────────────────────
|
||||
// Sections 1-2 start from hand-made KEYS ('adm0:IND'), so they could not see the resolver itself
|
||||
// misfile a country: once the world ADM0 boundaries carried a shapeName, "shapeName → ADM1" turned
|
||||
// every tapped country into a province (key 'adm1:Sudan', count null, 0 UUPG), and the Prayer List
|
||||
// refused it (reported from a phone, 2026-09-30). These are the properties the map ACTUALLY hands the
|
||||
// click handler (read off the live tapestry), so a resolver that keys on the wrong field fails here.
|
||||
{
|
||||
const { resolveTerritory, COUNTRY_COUNTS, ADM1_COUNTS } = await import(resolve(ROOT, 'plugin-designs/my-upg-100-list/data/territory-counts.js'))
|
||||
const country = resolveTerritory({ shapeGroup: 'SDN', shapeName: 'Sudan', iso3: 'SDN', zoneKey: 'sudan', zoneLabel: 'Sudan' })
|
||||
ok(country && country.kind === 'adm0' && country.key === 'adm0:SDN',
|
||||
`a tapped COUNTRY (shapeName + iso3, no listId) resolved as ${JSON.stringify(country)}, not adm0:SDN — every country tap would count 0 UUPG`)
|
||||
ok(country && country.count === COUNTRY_COUNTS.SDN && country.count > 0,
|
||||
`a tapped country's count is ${country && country.count}, not its COUNTRY_COUNTS entry (${COUNTRY_COUNTS.SDN})`)
|
||||
const state = resolveTerritory({ iso3: 'IND', shapeGroup: 'IND', listId: 'asia-india-madhya-pradesh', shapeName: 'Madhya Pradesh', zoneKey: 'asia-india-madhya-pradesh' })
|
||||
ok(state && state.kind === 'adm1' && state.key === 'adm1:Madhya Pradesh' && state.count === ADM1_COUNTS['Madhya Pradesh'],
|
||||
`a tapped India STATE (listId + shapeName + iso3) resolved as ${JSON.stringify(state)}, not adm1 with its ADM1_COUNTS entry`)
|
||||
const nepal = resolveTerritory({ shapeGroup: 'NPL', shapeName: 'Nepal', iso3: 'NPL', zoneKey: 'asia-india-uttarakhand' })
|
||||
ok(nepal && nepal.kind === 'adm0' && nepal.key === 'adm0:NPL',
|
||||
`a country drawn inside an Asia zone (zone.adm0, no listId) resolved as ${JSON.stringify(nepal)}, not adm0:NPL`)
|
||||
}
|
||||
|
||||
if (fails.length) {
|
||||
console.error('SELECTION-KINDS: FAIL')
|
||||
for (const f of fails) console.error(` ✗ ${f}`)
|
||||
|
|
|
|||
Loading…
Reference in a new issue