@@ -197,3 +197,32 @@ describe("SettingsService returns correct tab settings", () => {
197
197
expect ( tabSettings . rules . length ) . toBe ( 2 ) ;
198
198
} ) ;
199
199
} ) ;
200
+
201
+ describe ( "SettingsService returns correct Copybook Configuration Values" , ( ) => {
202
+ const mockConfigurationFetch = ( settings , configuredValue ) => jest . fn ( ) . mockReturnValue ( {
203
+ get : ( args : String ) => {
204
+ if ( settings === args ) {
205
+ return configuredValue ;
206
+ }
207
+ } ,
208
+ } ) ;
209
+
210
+ test ( "returns empty array when dialect configuration is not provided" , ( ) => {
211
+ vscode . workspace . getConfiguration = mockConfigurationFetch ( "dialect.paths-uss" , undefined ) ;
212
+ expect ( SettingsService . getUssPath ( "doc-uri" , "dialect" ) ) . toHaveLength ( 0 ) ;
213
+ } ) ;
214
+
215
+ test ( "returns configured array when dialect configuration is provided" , ( ) => {
216
+ vscode . workspace . getConfiguration = mockConfigurationFetch ( "dialect.paths-uss" , [ "configured-dialect-settings" ] ) ;
217
+ const configuredValue = SettingsService . getUssPath ( "doc-uri" , "dialect" ) ;
218
+ expect ( configuredValue ) . toHaveLength ( 1 ) ;
219
+ expect ( configuredValue [ 0 ] ) . toBe ( "configured-dialect-settings" ) ;
220
+ } ) ;
221
+
222
+ test ( "returns configured array for COBOL configuration" , ( ) => {
223
+ vscode . workspace . getConfiguration = mockConfigurationFetch ( "paths-uss" , [ "configured-cobol-settings" ] ) ;
224
+ const configuredValue = SettingsService . getUssPath ( "doc-uri" , SettingsService . DEFAULT_DIALECT ) ;
225
+ expect ( configuredValue ) . toHaveLength ( 1 ) ;
226
+ expect ( configuredValue [ 0 ] ) . toBe ( "configured-cobol-settings" ) ;
227
+ } ) ;
228
+ } ) ;
0 commit comments