@@ -134,6 +134,49 @@ describe("LLMContextCreator", () => {
134134 expect ( result ) . toContain ( message ) ;
135135 expect ( result ) . not . toContain ( "file1\nfile2" ) ;
136136 } ) ;
137+
138+ it ( "should load config with flexible referenceExamples" , async ( ) => {
139+ const mockConfig = {
140+ includeAllFilesOnEnvToContext : true ,
141+ referenceExamples : {
142+ serviceA : "src/services/ServiceA.ts" ,
143+ utilityB : "src/utils/UtilityB.ts" ,
144+ someOtherKey : "path/to/another/example.ts" ,
145+ } ,
146+ } ;
147+
148+ mocker . spyOnPrototypeAndReturn ( ConfigService , "getConfig" , mockConfig ) ;
149+
150+ const result = await contextCreator . create (
151+ "test message" ,
152+ "/test/root" ,
153+ true ,
154+ ) ;
155+
156+ expect ( result ) . toContain ( "Reference Examples" ) ;
157+ expect ( result ) . toContain ( "serviceA: src/services/ServiceA.ts" ) ;
158+ expect ( result ) . toContain ( "utilityB: src/utils/UtilityB.ts" ) ;
159+ expect ( result ) . toContain ( "someOtherKey: path/to/another/example.ts" ) ;
160+ } ) ;
161+
162+ it ( "should use default empty object for referenceExamples when not provided" , async ( ) => {
163+ const mockConfig = {
164+ includeAllFilesOnEnvToContext : true ,
165+ referenceExamples : { } ,
166+ } ;
167+
168+ mocker . spyOnPrototypeAndReturn ( ConfigService , "getConfig" , mockConfig ) ;
169+
170+ const result = await contextCreator . create (
171+ "test message" ,
172+ "/test/root" ,
173+ true ,
174+ ) ;
175+
176+ expect ( result ) . toContain ( "Reference Examples" ) ;
177+ expect ( result ) . not . toContain ( "serviceA:" ) ;
178+ expect ( result ) . not . toContain ( "utilityB:" ) ;
179+ } ) ;
137180 } ) ;
138181
139182 afterEach ( ( ) => {
0 commit comments