Skip to content

Commit b18f0d5

Browse files
authored
test: fails to uninstall Next LS (#79)
1 parent 3a59200 commit b18f0d5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/suite/extension.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as myExtension from "../../extension.js";
99
import * as uninstall from "../../commands/uninstall.js";
1010
import * as sinon from "sinon";
1111

12+
// TODO: should extract the tests to the directory of the file under test
1213
suite("Extension Test Suite", () => {
1314
vscode.window.showInformationMessage("Start all tests.");
1415
let showInformationMessage;
@@ -28,6 +29,7 @@ suite("Extension Test Suite", () => {
2829
sinon.restore();
2930
});
3031

32+
// TODO: should probably mock out the api calls to github
3133
test("downloads Next LS", async function () {
3234
fs.mkdirSync("./test-bin", { recursive: true });
3335

@@ -46,4 +48,18 @@ suite("Extension Test Suite", () => {
4648
`Uninstalled Next LS from ${path.normalize("test-bin/nextls")}`
4749
);
4850
});
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+
/Failed to uninstall Next LS from/
59+
);
60+
assert.match(
61+
showErrorMessage.getCall(0).args[0],
62+
/due to Error: ENOENT: no such file or directory, lstat/
63+
);
64+
});
4965
});

0 commit comments

Comments
 (0)