@@ -6,9 +6,11 @@ import { createTopLevelContext as topLevelContext } from '../../utils/MockContex
66
77describe ( 'TemplateSectionHoverProvider' , ( ) => {
88 let hoverProvider : TemplateSectionHoverProvider ;
9+ const mockFeatureFlagEnabled = { isEnabled : ( ) => true , describe : ( ) => 'Constants feature flag' } ;
10+ const mockFeatureFlagDisabled = { isEnabled : ( ) => false , describe : ( ) => 'Constants feature flag' } ;
911
1012 beforeEach ( ( ) => {
11- hoverProvider = new TemplateSectionHoverProvider ( ) ;
13+ hoverProvider = new TemplateSectionHoverProvider ( mockFeatureFlagEnabled ) ;
1214 } ) ;
1315
1416 function createTopLevelContext ( section : string ) {
@@ -95,6 +97,26 @@ describe('TemplateSectionHoverProvider', () => {
9597 expect ( result ) . toBe ( templateSectionDocsMap . get ( TopLevelSection . Description ) ) ;
9698 } ) ;
9799
100+ it ( 'should return documentation for Constants section when feature flag is enabled' , ( ) => {
101+ const provider = new TemplateSectionHoverProvider ( mockFeatureFlagEnabled ) ;
102+ const mockContext = createTopLevelContext ( TopLevelSection . Constants ) ;
103+
104+ const result = provider . getInformation ( mockContext ) ;
105+
106+ expect ( result ) . toBe ( templateSectionDocsMap . get ( TopLevelSection . Constants ) ) ;
107+ expect ( result ) . toBeDefined ( ) ;
108+ expect ( result ) . toContain ( 'Constants' ) ;
109+ } ) ;
110+
111+ it ( 'should return undefined for Constants section when feature flag is disabled' , ( ) => {
112+ const provider = new TemplateSectionHoverProvider ( mockFeatureFlagDisabled ) ;
113+ const mockContext = createTopLevelContext ( TopLevelSection . Constants ) ;
114+
115+ const result = provider . getInformation ( mockContext ) ;
116+
117+ expect ( result ) . toBeUndefined ( ) ;
118+ } ) ;
119+
98120 it ( 'should return undefined for Unknown section' , ( ) => {
99121 const mockContext = createTopLevelContext ( 'SomeUnknownSection' ) ;
100122 const result = hoverProvider . getInformation ( mockContext ) ;
0 commit comments