|
| 1 | +/*--------------------------------------------------------------------------------------------- |
| 2 | + * Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | + * Licensed under the MIT License. See License.txt in the project root for license information. |
| 4 | + *--------------------------------------------------------------------------------------------*/ |
| 5 | + |
| 6 | +import * as assert from 'assert'; |
| 7 | +import { deduceExtensionKind } from 'vs/workbench/services/extensions/common/extensionsUtil'; |
| 8 | +import { IExtensionManifest, ExtensionKind } from 'vs/platform/extensions/common/extensions'; |
| 9 | + |
| 10 | +suite('ExtensionKind', () => { |
| 11 | + |
| 12 | + function check(manifest: Partial<IExtensionManifest>, expected: ExtensionKind[]): void { |
| 13 | + assert.deepEqual(deduceExtensionKind(<IExtensionManifest>manifest), expected); |
| 14 | + } |
| 15 | + |
| 16 | + test('declarative with extension dependencies => workspace', () => { |
| 17 | + check({ extensionDependencies: ['ext1'] }, ['workspace']); |
| 18 | + }); |
| 19 | + |
| 20 | + test('declarative extension pack => workspace', () => { |
| 21 | + check({ extensionPack: ['ext1', 'ext2'] }, ['workspace']); |
| 22 | + }); |
| 23 | + |
| 24 | + test('declarative with unknown contribution point => workspace', () => { |
| 25 | + check({ contributes: <any>{ 'unknownPoint': { something: true } } }, ['workspace']); |
| 26 | + }); |
| 27 | + |
| 28 | + test('simple declarative => ui, workspace, web', () => { |
| 29 | + check({}, ['ui', 'workspace', 'web']); |
| 30 | + }); |
| 31 | + |
| 32 | + test('only browser => web', () => { |
| 33 | + check({ browser: 'main.browser.js' }, ['web']); |
| 34 | + }); |
| 35 | + |
| 36 | + test('only main => workspace', () => { |
| 37 | + check({ main: 'main.js' }, ['workspace']); |
| 38 | + }); |
| 39 | + |
| 40 | + test('main and browser => workspace, web', () => { |
| 41 | + check({ main: 'main.js', browser: 'main.browser.js' }, ['workspace', 'web']); |
| 42 | + }); |
| 43 | +}); |
0 commit comments