|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the VS Code Swift open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2024 the VS Code Swift project authors |
| 6 | +// Licensed under Apache License v2.0 |
| 7 | +// |
| 8 | +// See LICENSE.txt for license information |
| 9 | +// See CONTRIBUTORS.txt for the list of VS Code Swift project authors |
| 10 | +// |
| 11 | +// SPDX-License-Identifier: Apache-2.0 |
| 12 | +// |
| 13 | +//===----------------------------------------------------------------------===// |
| 14 | + |
| 15 | +import * as vscode from "vscode"; |
| 16 | +import { mockGlobalObject } from "../../MockUtils"; |
| 17 | +import { expect } from "chai"; |
| 18 | +import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities"; |
| 19 | +import { Commands } from "../../../src/commands"; |
| 20 | + |
| 21 | +suite("runPluginTask Test Suite", () => { |
| 22 | + const executeCommand = vscode.commands.executeCommand; |
| 23 | + const commandsMock = mockGlobalObject(vscode, "commands"); |
| 24 | + |
| 25 | + activateExtensionForSuite({ |
| 26 | + async setup(ctx) { |
| 27 | + await folderInRootWorkspace("command-plugin", ctx); |
| 28 | + }, |
| 29 | + }); |
| 30 | + |
| 31 | + test("Executes runTask command", async () => { |
| 32 | + executeCommand(Commands.RUN_PLUGIN_TASK); |
| 33 | + |
| 34 | + expect(commandsMock.executeCommand).to.have.been.calledOnceWith( |
| 35 | + "workbench.action.tasks.runTask", |
| 36 | + { type: "swift-plugin" } |
| 37 | + ); |
| 38 | + }); |
| 39 | +}); |
0 commit comments