@@ -53,22 +53,37 @@ suite('Linter Info - Pylint', () => {
5353
5454 expect ( linterInfo . isEnabled ( ) ) . to . be . false ;
5555 } ) ;
56- test ( 'Test enabled when using Language Server and Pylint is configured' , async ( ) => {
57- const config = mock ( ConfigurationService ) ;
58- const workspaceService = mock ( WorkspaceService ) ;
59- const linterInfo = new PylintLinterInfo ( instance ( config ) , instance ( workspaceService ) , [ ] ) ;
56+ const testsForisEnabled =
57+ [
58+ {
59+ testName : 'When workspaceFolder setting is provided' ,
60+ inspection : { workspaceFolderValue : true }
61+ } ,
62+ {
63+ testName : 'When workspace setting is provided' ,
64+ inspection : { workspaceValue : true }
65+ } ,
66+ {
67+ testName : 'When global setting is provided' ,
68+ inspection : { globalValue : true }
69+ }
70+ ] ;
6071
61- const inspection = {
62- globalValue : 'something' ,
63- workspaceFolderValue : 'something' ,
64- workspaceValue : 'something'
65- } ;
66- const pythonConfig = {
67- inspect : ( ) => inspection
68- } ;
69- when ( config . getSettings ( anything ( ) ) ) . thenReturn ( { linting : { pylintEnabled : true } , jediEnabled : false } as any ) ;
70- when ( workspaceService . getConfiguration ( 'python' , anything ( ) ) ) . thenReturn ( pythonConfig as any ) ;
72+ suite ( 'Test is enabled when using Language Server and Pylint is configured' , ( ) => {
73+ testsForisEnabled . forEach ( testParams => {
74+ test ( testParams . testName , async ( ) => {
75+ const config = mock ( ConfigurationService ) ;
76+ const workspaceService = mock ( WorkspaceService ) ;
77+ const linterInfo = new PylintLinterInfo ( instance ( config ) , instance ( workspaceService ) , [ ] ) ;
7178
72- expect ( linterInfo . isEnabled ( ) ) . to . be . true ;
79+ const pythonConfig = {
80+ inspect : ( ) => testParams . inspection
81+ } ;
82+ when ( config . getSettings ( anything ( ) ) ) . thenReturn ( { linting : { pylintEnabled : true } , jediEnabled : false } as any ) ;
83+ when ( workspaceService . getConfiguration ( 'python' , anything ( ) ) ) . thenReturn ( pythonConfig as any ) ;
84+
85+ expect ( linterInfo . isEnabled ( ) ) . to . be . true ;
86+ } ) ;
87+ } ) ;
7388 } ) ;
7489} ) ;
0 commit comments