|
| 1 | +/*--------------------------------------------------------------------------------------------- |
| 2 | + * Alexa Skills Toolkit for Visual Studio Code |
| 3 | + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + *--------------------------------------------------------------------------------------------*/ |
| 6 | +import * as vscode from "vscode"; |
| 7 | +import * as assert from "assert"; |
| 8 | +import * as sinon from "sinon"; |
| 9 | + |
| 10 | +import {DeviceRegistryCommand} from "../../../src/askContainer/commands/deviceRegistryCommand"; |
| 11 | +import {stubTelemetryClient} from "../../../test/testUtilities"; |
| 12 | + |
| 13 | +describe("Command askContainer.skillsConsole.deviceRegistry", () => { |
| 14 | + let command: DeviceRegistryCommand; |
| 15 | + let sandbox: sinon.SinonSandbox; |
| 16 | + |
| 17 | + after(() => { |
| 18 | + command.dispose(); |
| 19 | + }); |
| 20 | + beforeEach(() => { |
| 21 | + sandbox = sinon.createSandbox(); |
| 22 | + stubTelemetryClient(sandbox); |
| 23 | + }); |
| 24 | + |
| 25 | + afterEach(() => { |
| 26 | + sandbox.restore(); |
| 27 | + }); |
| 28 | + |
| 29 | + it("Should show the view when executed", async () => { |
| 30 | + const showViewSpy = sinon.spy(); |
| 31 | + command = new DeviceRegistryCommand({showView: showViewSpy} as any); |
| 32 | + |
| 33 | + /* |
| 34 | + undefined argument due to |
| 35 | +
|
| 36 | + https://code.visualstudio.com/api/references/contribution-points#contributes.menus |
| 37 | + Note: When a command is invoked from a (context) menu, VS Code tries to infer the currently selected resource |
| 38 | + and passes that as a parameter when invoking the command. |
| 39 | +
|
| 40 | + */ |
| 41 | + await vscode.commands.executeCommand("askContainer.skillsConsole.deviceRegistry", undefined); |
| 42 | + |
| 43 | + assert.ok(showViewSpy.called); |
| 44 | + }); |
| 45 | +}); |
0 commit comments