// Verify the GIS-aligned far wrapper only references aligned coarse CAD content. import assert from 'node:assert/strict' import { readFileSync, existsSync } from 'node:fs' import { join, resolve } from 'node:path' const dir = resolve(process.argv[2] || 'tools/city-massing/city/cad-bim/far-aligned') const tree = JSON.parse(readFileSync(join(dir, 'tileset.json'), 'utf8')) const report = JSON.parse(readFileSync(join(dir, 'manifest.json'), 'utf8')) assert.equal(tree.asset.generator, 'CAD GIS-aligned far coarse wrapper') assert.equal(report.generator, tree.asset.generator) assert.equal(report.buildings, 30159) assert.ok(tree.root?.content?.uri?.endsWith('root-anchor.glb')) assert.equal(tree.root?.transform?.length, 16) assert.ok(tree.root.children?.length >= 70) assert.ok(!JSON.stringify(tree).includes('/gis/city')) assert.ok(!JSON.stringify(tree).includes('town.glb')) for (const child of tree.root.children) { assert.ok(/-(aligned|roofed)\//.test(child.content?.uri || ''), child.id) assert.ok(child.content.uri.endsWith('-lod1.glb'), child.content.uri) assert.ok(child.boundingVolume?.box, child.id) const path = resolve(dir, child.content.uri) assert.ok(existsSync(path), `missing ${path}`) } console.log(JSON.stringify({ passed: true, buildings: report.buildings, coarseFiles: report.coarseFiles, childCount: tree.root.children.length, boundsENU: report.boundsENU }))