@@ -14,7 +14,11 @@ describe('EntityFieldCompletionProvider', () => {
1414
1515 describe ( 'Parameter' , ( ) => {
1616 test ( 'should suggest Default, Description, ConstraintDescription with e as partial string' , ( ) => {
17- const mockContext = createParameterContext ( 'MyParameter' , { text : 'e' , data : { Type : 'String' } } ) ;
17+ const mockContext = createParameterContext ( 'MyParameter' , {
18+ text : 'e' ,
19+ data : { Type : 'String' } ,
20+ propertyPath : [ 'Parameters' , 'MyParameter' , 'e' ] ,
21+ } ) ;
1822 const result = parameterFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
1923 expect ( result ) . toBeDefined ( ) ;
2024 expect ( result ?. length ) . equal ( 9 ) ;
@@ -23,7 +27,11 @@ describe('EntityFieldCompletionProvider', () => {
2327 } ) ;
2428
2529 test ( 'should be robust against typos and suggest Type when partial string is yp' , ( ) => {
26- const mockContext = createParameterContext ( 'MyParameter' , { text : 'yp' , data : { Type : undefined } } ) ;
30+ const mockContext = createParameterContext ( 'MyParameter' , {
31+ text : 'yp' ,
32+ data : { Type : undefined } ,
33+ propertyPath : [ 'Parameters' , 'MyParameter' , 'yp' ] ,
34+ } ) ;
2735 const result = parameterFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
2836 expect ( result ) . toBeDefined ( ) ;
2937 expect ( result ?. length ) . equal ( 1 ) ;
@@ -37,6 +45,7 @@ describe('EntityFieldCompletionProvider', () => {
3745 Type : 'string' ,
3846 Description : 'some description' ,
3947 } ,
48+ propertyPath : [ 'Parameters' , 'MyParameter' , 'e' ] ,
4049 } ) ;
4150 const result = parameterFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
4251 expect ( result ) . toBeDefined ( ) ;
@@ -47,7 +56,11 @@ describe('EntityFieldCompletionProvider', () => {
4756 } ) ;
4857
4958 test ( 'should suggest all available fields starting with Type (required) when nothing typed yet' , ( ) => {
50- const mockContext = createParameterContext ( 'MyParameter' , { text : '' , data : { Type : undefined } } ) ;
59+ const mockContext = createParameterContext ( 'MyParameter' , {
60+ text : '' ,
61+ data : { Type : undefined } ,
62+ propertyPath : [ 'Parameters' , 'MyParameter' , '' ] ,
63+ } ) ;
5164 const result = parameterFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
5265 expect ( result ) . toBeDefined ( ) ;
5366 // All Parameter fields should be suggested when none are defined
@@ -80,6 +93,7 @@ describe('EntityFieldCompletionProvider', () => {
8093 Description : 'some description' ,
8194 Default : 'default value' ,
8295 } ,
96+ propertyPath : [ 'Parameters' , 'MyParameter' , '' ] ,
8397 } ) ;
8498 const result = parameterFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
8599 expect ( result ) . toBeDefined ( ) ;
@@ -103,7 +117,10 @@ describe('EntityFieldCompletionProvider', () => {
103117
104118 describe ( 'Output' , ( ) => {
105119 test ( 'should suggest export and description with e as partial string' , ( ) => {
106- const mockContext = createOutputContext ( 'MyOutput' , { text : 'e' } ) ;
120+ const mockContext = createOutputContext ( 'MyOutput' , {
121+ text : 'e' ,
122+ propertyPath : [ 'Outputs' , 'MyOutput' , 'e' ] ,
123+ } ) ;
107124 const result = outputFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
108125 expect ( result ) . toBeDefined ( ) ;
109126 expect ( result ?. length ) . equal ( 2 ) ;
@@ -112,7 +129,10 @@ describe('EntityFieldCompletionProvider', () => {
112129 } ) ;
113130
114131 test ( 'should be robust against typos and suggest Export when partial string is xpo' , ( ) => {
115- const mockContext = createOutputContext ( 'MyOutput' , { text : 'xpo' } ) ;
132+ const mockContext = createOutputContext ( 'MyOutput' , {
133+ text : 'xpo' ,
134+ propertyPath : [ 'Outputs' , 'MyOutput' , 'xpo' ] ,
135+ } ) ;
116136 const result = outputFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
117137 expect ( result ) . toBeDefined ( ) ;
118138 expect ( result ?. length ) . equal ( 1 ) ;
@@ -125,6 +145,7 @@ describe('EntityFieldCompletionProvider', () => {
125145 data : {
126146 Description : 'some description' ,
127147 } ,
148+ propertyPath : [ 'Outputs' , 'MyOutput' , 'e' ] ,
128149 } ) ;
129150 const result = outputFieldCompletionProvider . getCompletions ( mockContext , mockParams ) ;
130151 expect ( result ) . toBeDefined ( ) ;
0 commit comments