Skip to content

Commit

Permalink
Added invoke unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Schmid committed Dec 27, 2017
1 parent b4f10b1 commit 3ebf9cd
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/lib/CommandHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as chai from "chai";
import * as _ from "lodash";
import * as sinon from "sinon";
import * as sinon_chai from "sinon-chai";
import { commands, ExtensionContext, Memento, window } from "vscode";
Expand Down Expand Up @@ -27,7 +28,7 @@ class TestCommand implements ICommand {
}

public invoke(node: ServerlessNode): Thenable<void> {
throw new Error("Method not implemented.");
throw new Error("TestCommand: Method not implemented.");
}
}

Expand Down Expand Up @@ -68,5 +69,22 @@ describe("CommandHandler", () => {
const registeredCommands = await commands.getCommands();
expect(registeredCommands).to.include("serverless.test");
});

it("should invoke registered command", async () => {
const registeredCommands = await commands.getCommands();
if (!_.includes(registeredCommands, "serverless.test")) {
CommandHandler.registerCommand(
TestCommand,
"serverless.test",
testContext,
);
}

return commands.executeCommand("serverless.test")
.then(
() => expect(true).to.be.false,
_.noop,
);
});
});
});

0 comments on commit 3ebf9cd

Please sign in to comment.