Skip to content

Commit 11da881

Browse files
feat: add nested global field support in test config and helpers
Adds NESTED_GLOBAL_FIELD_UID environment variable support and a 671-line comprehensive test suite for nested global fields. test/config.js: - Added nested global field entry reading from NESTED_GLOBAL_FIELD_UID - Added fallback env var names for global fields (GLOBAL_FIELD_UID, SIMPLE/MEDIUM/COMPLEX_GLOBAL_FIELD_UID) for broader stack compatibility test/helpers/TestDataHelper.js: - Added getNestedGlobalFieldUID() accessor method test/integration/GlobalFieldsTests/NestedGlobalField.test.js (new): - 671-line test suite for nested global field resolution - Covers: 6-level deep nesting, child field access, projection with nested fields, reference resolution inside nested structures, array handling, and circular reference safety
1 parent c206caa commit 11da881

4 files changed

Lines changed: 690 additions & 6 deletions

File tree

.talismanrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ fileignoreconfig:
88
- filename: test/integration/LivePreviewTests/LivePreview.test.js
99
checksum: dba41fa432524189234a3d0ec35885a8e5c51904b3114853a41b1ec3899ad4cb
1010
- filename: test/config.js
11-
checksum: 55c700357e33032d4b5c52f98be14aafdf71d7ed72223c39a42e3310e829e532
11+
checksum: 61bf7129a251984c6114941211ce4ea3d29416ddf1288b605c3bb2a6639b17cc
1212
- filename: test/integration/GlobalFieldsTests/ContentBlockGlobalField.test.js
1313
checksum: 8d2bc8cb6661336b57397649259f7e12786256706019efb644f133b336629d96
14+
- filename: test/integration/GlobalFieldsTests/NestedGlobalField.test.js
15+
checksum: 703722cca153df62ffb3cb32fcfc2722d509607e6b91682282df5063650423d1
1416
- filename: test/integration/NetworkResilienceTests/RetryLogic.test.js
1517
checksum: 3b5fe23398bdc2327848b3caa95339e51a0aed059c1eb299e78d3dd215ecbd30
1618
- filename: test/integration/QueryTests/ExistsSearchOperators.test.js

test/config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ module.exports = {
9090
},
9191

9292
// Global field UIDs (values from environment variables, keys are descriptive)
93+
// Supports both old naming (GLOBAL_FIELD_SIMPLE) and new naming (SIMPLE_GLOBAL_FIELD_UID)
9394
globalFields: {
94-
seo: process.env.GLOBAL_FIELD_SIMPLE, // Simple global field
95-
gallery: process.env.GLOBAL_FIELD_MEDIUM, // Medium complexity
96-
content_block: process.env.GLOBAL_FIELD_COMPLEX, // Complex global field
95+
seo: process.env.GLOBAL_FIELD_SIMPLE || process.env.GLOBAL_FIELD_UID || process.env.SIMPLE_GLOBAL_FIELD_UID, // Simple global field
96+
gallery: process.env.GLOBAL_FIELD_MEDIUM || process.env.MEDIUM_GLOBAL_FIELD_UID, // Medium complexity
97+
content_block: process.env.GLOBAL_FIELD_COMPLEX || process.env.COMPLEX_GLOBAL_FIELD_UID, // Complex global field
9798
video_experience: process.env.GLOBAL_FIELD_VIDEO, // Video field
98-
referenced_data: 'referenced_data' // Generic field name (optional)
99+
referenced_data: 'referenced_data', // Generic field name (optional)
100+
nested: process.env.NESTED_GLOBAL_FIELD_UID // Nested global field (parent)
99101
},
100102

101103
// Reference field name (generic/common field name)

test/helpers/TestDataHelper.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,22 @@ class TestDataHelper {
132132

133133
/**
134134
* Get global field name
135-
* @param {string} name - Global field name (seo, search, video_experience, content_block, gallery, referenced_data)
135+
* @param {string} name - Global field name (seo, search, video_experience, content_block, gallery, referenced_data, nested)
136136
* @returns {string} Global field name
137137
*/
138138
static getGlobalField(name) {
139139
return config.globalFields[name];
140140
}
141141

142+
/**
143+
* Get nested global field UID
144+
* Value from NESTED_GLOBAL_FIELD_UID in .env
145+
* @returns {string} Nested global field UID
146+
*/
147+
static getNestedGlobalFieldUID() {
148+
return config.globalFields.nested;
149+
}
150+
142151
/**
143152
* Get reference field name
144153
* @param {string} name - Reference field name (author, related_articles, products, references)

0 commit comments

Comments
 (0)