Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fails to uninstall Next LS #79

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as myExtension from "../../extension.js";
import * as uninstall from "../../commands/uninstall.js";
import * as sinon from "sinon";

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

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

Expand All @@ -46,4 +48,18 @@ suite("Extension Test Suite", () => {
`Uninstalled Next LS from ${path.normalize("test-bin/nextls")}`
);
});

test("fails to uninstalls Next LS", async function () {
let showErrorMessage = sinon.stub(vscode.window, "showErrorMessage");
await uninstall.run("./test-bin");

assert.match(
showErrorMessage.getCall(0).args[0],
/Failed to uninstall Next LS from/
);
assert.match(
showErrorMessage.getCall(0).args[0],
/due to Error: ENOENT: no such file or directory, lstat/
);
});
});
Loading