-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Will mock to verify correct command is called Issue: #1230
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the VS Code Swift open source project | ||
// | ||
// Copyright (c) 2024 the VS Code Swift project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of VS Code Swift project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import * as vscode from "vscode"; | ||
import { mockGlobalObject } from "../../MockUtils"; | ||
import { expect } from "chai"; | ||
import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities"; | ||
import { Commands } from "../../../src/commands"; | ||
|
||
suite("runPluginTask Test Suite", () => { | ||
const executeCommand = vscode.commands.executeCommand; | ||
const commandsMock = mockGlobalObject(vscode, "commands"); | ||
|
||
activateExtensionForSuite({ | ||
async setup(ctx) { | ||
await folderInRootWorkspace("command-plugin", ctx); | ||
}, | ||
}); | ||
|
||
test("Executes runTask command", async () => { | ||
executeCommand(Commands.RUN_PLUGIN_TASK); | ||
|
||
expect(commandsMock.executeCommand).to.have.been.calledOnceWith( | ||
"workbench.action.tasks.runTask", | ||
{ type: "swift-plugin" } | ||
); | ||
}); | ||
}); |