@@ -9,6 +9,7 @@ import * as myExtension from "../../extension.js";
9
9
import * as uninstall from "../../commands/uninstall.js" ;
10
10
import * as sinon from "sinon" ;
11
11
12
+ // TODO: should extract the tests to the directory of the file under test
12
13
suite ( "Extension Test Suite" , ( ) => {
13
14
vscode . window . showInformationMessage ( "Start all tests." ) ;
14
15
let showInformationMessage ;
@@ -28,6 +29,7 @@ suite("Extension Test Suite", () => {
28
29
sinon . restore ( ) ;
29
30
} ) ;
30
31
32
+ // TODO: should probably mock out the api calls to github
31
33
test ( "downloads Next LS" , async function ( ) {
32
34
fs . mkdirSync ( "./test-bin" , { recursive : true } ) ;
33
35
@@ -46,4 +48,18 @@ suite("Extension Test Suite", () => {
46
48
`Uninstalled Next LS from ${ path . normalize ( "test-bin/nextls" ) } `
47
49
) ;
48
50
} ) ;
51
+
52
+ test ( "fails to uninstalls Next LS" , async function ( ) {
53
+ let showErrorMessage = sinon . stub ( vscode . window , "showErrorMessage" ) ;
54
+ await uninstall . run ( "./test-bin" ) ;
55
+
56
+ assert . match (
57
+ showErrorMessage . getCall ( 0 ) . args [ 0 ] ,
58
+ / F a i l e d t o u n i n s t a l l N e x t L S f r o m /
59
+ ) ;
60
+ assert . match (
61
+ showErrorMessage . getCall ( 0 ) . args [ 0 ] ,
62
+ / d u e t o E r r o r : E N O E N T : n o s u c h f i l e o r d i r e c t o r y , l s t a t /
63
+ ) ;
64
+ } ) ;
49
65
} ) ;
0 commit comments