@@ -21,9 +21,13 @@ describe('Should do codeAction', () => {
21
21
await testCodeAction ( docUri , sameLineRange ( 5 , 6 , 6 ) , codeActions ) ;
22
22
} ) ;
23
23
24
+ it ( 'finds fixAll codeAction for unused import' , async ( ) => {
25
+ const codeActions = [ { title : `Delete all unused declarations` , command : 'vetur.chooseTypeScriptCodeAction' } ] ;
26
+ await testCodeAction ( docUri , sameLineRange ( 5 , 6 , 6 ) , codeActions ) ;
27
+ } ) ;
28
+
24
29
it ( 'finds codeAction for unused variables' , async ( ) => {
25
30
const codeActions = [ { title : `Remove declaration for: 'foo'` , command : 'vetur.applyWorkspaceEdits' } ] ;
26
-
27
31
await testCodeAction ( docUri , sameLineRange ( 7 , 6 , 6 ) , codeActions ) ;
28
32
} ) ;
29
33
} ) ;
@@ -37,16 +41,15 @@ async function testCodeAction(docUri: vscode.Uri, range: vscode.Range, expectedA
37
41
// For diagnostics to show up
38
42
await sleep ( 2000 ) ;
39
43
40
- const result = ( await vscode . commands . executeCommand (
41
- 'vscode.executeCodeActionProvider' ,
42
- docUri ,
43
- range
44
- ) ) as CodeAction [ ] ;
44
+ const result = ( await vscode . commands . executeCommand ( 'vscode.executeCodeActionProvider' , docUri , range ) ) as {
45
+ title : string ;
46
+ command : { command : string } ;
47
+ } [ ] ;
45
48
46
49
expectedActions . forEach ( eAction => {
47
50
assert . ok (
48
51
result . some ( rAction => {
49
- return rAction . title === eAction . title && rAction . command === eAction . command ;
52
+ return rAction . title === eAction . title && rAction . command . command === eAction . command ;
50
53
} ) ,
51
54
`Cannot find matching codeAction with title '${ eAction . title } '\n` +
52
55
`Seen codeActions are:\n${ JSON . stringify ( result , null , 2 ) } `
0 commit comments