Skip to content

Commit

Permalink
feat(testing): add asExternalUri
Browse files Browse the repository at this point in the history
This modifies the test extension used in e2e test by registering a new
command for testing `asExternalUri`.
  • Loading branch information
jsjoeio committed Oct 7, 2022
1 parent b64d3c6 commit 9681169
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/e2e/extensions/test-extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as vscode from "vscode"

export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage("test extension loaded")
// Test extension
context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.proxyUri", () => {
if (process.env.VSCODE_PROXY_URI) {
Expand All @@ -11,4 +12,20 @@ export function activate(context: vscode.ExtensionContext) {
}
}),
)

// asExternalUri extension
context.subscriptions.push(
vscode.commands.registerCommand("codeServerTest.asExternalUri", async () => {
const input = await vscode.window.showInputBox({
prompt: "URL to pass through to asExternalUri",
})

if (input) {
const output = await vscode.env.asExternalUri(vscode.Uri.parse(input))
vscode.window.showInformationMessage(`input: ${input} output: ${output}`)
} else {
vscode.window.showErrorMessage(`Failed to run test case. No input provided.`)
}
}),
)
}
5 changes: 5 additions & 0 deletions test/e2e/extensions/test-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"command": "codeServerTest.proxyUri",
"title": "Get proxy URI",
"category": "code-server"
},
{
"command": "codeServerTest.asExternalUri",
"title": "asExternalUri test",
"category": "code-server"
}
]
},
Expand Down

0 comments on commit 9681169

Please sign in to comment.