fix(scripts): emitPrefabJson rootNode._children 必须包含 group-X 节点 (Task 9 fix round 1)
This commit is contained in:
@@ -28,4 +28,17 @@ test('Layer00619 端到端生成 + 校验关键字段', () => {
|
||||
// 校验含 group-55 父节点 (BackHall_Layer.xml Spirit BelongGroupID=55).
|
||||
const groupNode = json.find(o => o.__type__ === 'cc.Node' && o._name === 'group-55');
|
||||
assert.ok(groupNode, '应有 group-55 父节点');
|
||||
});
|
||||
|
||||
test('Layer00619 端到端 - root._children 包含 group-55', () => {
|
||||
execSync(`${CLI} ${INPUT} ${TARGET} ${OUTPUT_DIR}`, { stdio: 'pipe' });
|
||||
const json = JSON.parse(readFileSync(OUTPUT, 'utf8'));
|
||||
const rootNode = json.find(o => o.__type__ === 'cc.Node' && o._name === 'BackHall_Layer');
|
||||
const groupNode = json.find(o => o.__type__ === 'cc.Node' && o._name === 'group-55');
|
||||
assert.ok(rootNode, '应有 root node');
|
||||
assert.ok(groupNode, '应有 group-55 node');
|
||||
// The fix: root._children must reference group-55
|
||||
const childIds = (rootNode._children || []).map(c => c.__id__);
|
||||
assert.ok(childIds.includes(json.indexOf(groupNode)),
|
||||
`root._children must include group-55 reference; got [${childIds.join(', ')}]`);
|
||||
});
|
||||
Reference in New Issue
Block a user