Skip to content

Commit 9681169

Browse files
committed
feat(testing): add asExternalUri
This modifies the test extension used in e2e test by registering a new command for testing `asExternalUri`.
1 parent b64d3c6 commit 9681169

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/e2e/extensions/test-extension/extension.ts

+17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as vscode from "vscode"
22

33
export function activate(context: vscode.ExtensionContext) {
44
vscode.window.showInformationMessage("test extension loaded")
5+
// Test extension
56
context.subscriptions.push(
67
vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
78
if (process.env.VSCODE_PROXY_URI) {
@@ -11,4 +12,20 @@ export function activate(context: vscode.ExtensionContext) {
1112
}
1213
}),
1314
)
15+
16+
// asExternalUri extension
17+
context.subscriptions.push(
18+
vscode.commands.registerCommand("codeServerTest.asExternalUri", async () => {
19+
const input = await vscode.window.showInputBox({
20+
prompt: "URL to pass through to asExternalUri",
21+
})
22+
23+
if (input) {
24+
const output = await vscode.env.asExternalUri(vscode.Uri.parse(input))
25+
vscode.window.showInformationMessage(`input: ${input} output: ${output}`)
26+
} else {
27+
vscode.window.showErrorMessage(`Failed to run test case. No input provided.`)
28+
}
29+
}),
30+
)
1431
}

test/e2e/extensions/test-extension/package.json

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
"command": "codeServerTest.proxyUri",
1818
"title": "Get proxy URI",
1919
"category": "code-server"
20+
},
21+
{
22+
"command": "codeServerTest.asExternalUri",
23+
"title": "asExternalUri test",
24+
"category": "code-server"
2025
}
2126
]
2227
},

0 commit comments

Comments
 (0)