Skip to content

Commit

Permalink
test: fails to uninstall Next LS
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanberg committed Mar 2, 2024
1 parent 3a59200 commit e681148
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ 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;

setup(function () {
setup(function() {

Check failure on line 17 in src/test/suite/extension.test.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
fs.rmSync("./test-bin", { recursive: true, force: true });
showInformationMessage = sinon
.stub(vscode.window, "showInformationMessage")
Expand All @@ -24,18 +25,19 @@ suite("Extension Test Suite", () => {
);
});

teardown(function () {
teardown(function() {

Check failure on line 28 in src/test/suite/extension.test.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
sinon.restore();
});

test("downloads Next LS", async function () {
// TODO: should probably mock out the api calls to github
test("downloads Next LS", async function() {

Check failure on line 33 in src/test/suite/extension.test.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
fs.mkdirSync("./test-bin", { recursive: true });

let result = await myExtension.ensureNextLSDownloaded("test-bin");
assert.equal(path.normalize(result), path.normalize("test-bin/nextls"));
});

test("uninstalls Next LS", async function () {
test("uninstalls Next LS", async function() {

Check failure on line 40 in src/test/suite/extension.test.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
fs.mkdirSync("./test-bin", { recursive: true });
fs.writeFileSync("./test-bin/nextls", "hello word");

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

test("fails to uninstalls Next LS", async function() {

Check failure on line 52 in src/test/suite/extension.test.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `·`
let showErrorMessage = sinon.stub(vscode.window, "showErrorMessage");
await uninstall.run("./test-bin");

assert.equal(
showErrorMessage.getCall(0).args[0],
`Failed to uninstall Next LS from ${path.normalize("test-bin/nextls")} due to Error: ENOENT: no such file or directory, lstat 'test-bin/nextls'`

Check failure on line 58 in src/test/suite/extension.test.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `"test-bin/nextls"` with `⏎········"test-bin/nextls"⏎······`
);
});
});

0 comments on commit e681148

Please sign in to comment.