MCPcopy Create free account
hub / github.com/github/gh-aw / TestMergedFeaturesTopLevelPrecedence

Function TestMergedFeaturesTopLevelPrecedence

pkg/workflow/features_test.go:272–295  ·  view source on GitHub ↗

TestMergedFeaturesTopLevelPrecedence verifies that top-level features take precedence over imported features in the merged features map

(t *testing.T)

Source from the content-addressed store, hash-verified

270// TestMergedFeaturesTopLevelPrecedence verifies that top-level features take precedence
271// over imported features in the merged features map
272func TestMergedFeaturesTopLevelPrecedence(t *testing.T) {
273 // This test verifies that when features are merged, top-level features override imports
274 // The actual merging happens in MergeFeatures function, but we test the end result here
275
276 // Simulate a workflow where top-level feature overrides an imported one
277 workflowData := &WorkflowData{
278 Features: map[string]any{
279 "override-feature": false, // Top-level value (overriding import that had true)
280 "import-only": true, // Only from import
281 },
282 }
283
284 // Verify that the overridden value is what isFeatureEnabled sees
285 overrideResult := isFeatureEnabled(constants.FeatureFlag("override-feature"), workflowData)
286 if overrideResult != false {
287 t.Errorf("isFeatureEnabled(\"override-feature\") = %v, want false (top-level override)", overrideResult)
288 }
289
290 // Verify that import-only feature is still accessible
291 importOnlyResult := isFeatureEnabled(constants.FeatureFlag("import-only"), workflowData)
292 if importOnlyResult != true {
293 t.Errorf("isFeatureEnabled(\"import-only\") = %v, want true (from import)", importOnlyResult)
294 }
295}
296
297func TestInlineAgentsFeatureAlwaysEnabled(t *testing.T) {
298 t.Setenv("GH_AW_FEATURES", "")

Callers

nothing calls this directly

Calls 3

FeatureFlagTypeAlias · 0.92
isFeatureEnabledFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected