Skip to content

Commit 5c63c66

Browse files
committed
Add test
1 parent 8610916 commit 5c63c66

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

test/integration-tests/commands/runPlayground.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import { FolderContext } from "@src/FolderContext";
1919
import { WorkspaceContext } from "@src/WorkspaceContext";
2020
import { Commands } from "@src/commands";
2121
import { runPlayground } from "@src/commands/runPlayground";
22+
import { Playground } from "@src/sourcekit-lsp/extensions";
2223
import { SwiftTask } from "@src/tasks/SwiftTaskProvider";
2324
import { TaskManager } from "@src/tasks/TaskManager";
25+
import { PlaygroundNode } from "@src/ui/ProjectPanelProvider";
2426

2527
import { MockedObject, instance, mockObject } from "../../MockUtils";
2628
import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities";
@@ -43,14 +45,30 @@ suite("Run Playground Command", function () {
4345
});
4446

4547
suite("Command", () => {
46-
test("Succeeds", async () => {
48+
test("Succeeds with PlaygroundItem", async () => {
4749
expect(
4850
await vscode.commands.executeCommand(Commands.PLAY, {
4951
id: "PackageLib/PackageLib.swift:3",
5052
})
5153
).to.be.true;
5254
});
5355

56+
test("Succeeds with PlaygroundNode", async () => {
57+
expect(
58+
await vscode.commands.executeCommand(
59+
Commands.PLAY,
60+
new PlaygroundNode(
61+
{
62+
label: "foo",
63+
id: "PackageLib/PackageLib.swift:3",
64+
} as Playground,
65+
folderContext,
66+
new Set()
67+
)
68+
)
69+
).to.be.true;
70+
});
71+
5472
test("No playground item provided", async () => {
5573
expect(await vscode.commands.executeCommand(Commands.PLAY), undefined).to.be.false;
5674
});

0 commit comments

Comments
 (0)