mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
api - fold app uri creation into asExternalUri (fix #82884)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { env, extensions, ExtensionKind, UIKind } from 'vscode';
|
||||
import { env, extensions, ExtensionKind, UIKind, Uri } from 'vscode';
|
||||
|
||||
suite('env-namespace', () => {
|
||||
|
||||
@@ -45,8 +45,29 @@ suite('env-namespace', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('env.uiKind', function () {
|
||||
test('env.uiKind', async function () {
|
||||
const uri = Uri.parse(`${env.uriScheme}:://vscode.vscode-api-tests/path?key=value&other=false`);
|
||||
const result = await env.asExternalUri(uri);
|
||||
|
||||
const kind = env.uiKind;
|
||||
assert.equal(kind, UIKind.Desktop);
|
||||
if (result.scheme === 'http' || result.scheme === 'https') {
|
||||
assert.equal(kind, UIKind.Web);
|
||||
} else {
|
||||
assert.equal(kind, UIKind.Desktop);
|
||||
}
|
||||
});
|
||||
|
||||
test('env.asExternalUri - with env.uriScheme', async function () {
|
||||
const uri = Uri.parse(`${env.uriScheme}:://vscode.vscode-api-tests/path?key=value&other=false`);
|
||||
const result = await env.asExternalUri(uri);
|
||||
assert.ok(result);
|
||||
|
||||
if (env.uiKind === UIKind.Desktop) {
|
||||
assert.equal(uri.scheme, result.scheme);
|
||||
assert.equal(uri.authority, result.authority);
|
||||
assert.equal(uri.path, result.path);
|
||||
} else {
|
||||
assert.ok(result.scheme === 'http' || result.scheme === 'https');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user