mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 08:40:29 -04:00
Merge from vscode fc10e26ea50f82cdd84e9141491357922e6f5fba (#4639)
This commit is contained in:
@@ -38,6 +38,7 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
import { ExtensionIdentifier, IExtensionContributions, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
suite('ExtensionsActions Test', () => {
|
||||
|
||||
@@ -110,7 +111,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return workbenchService.queryLocal()
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier })));
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
assert.ok(!testObject.enabled);
|
||||
@@ -126,7 +127,7 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
@@ -143,7 +144,7 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
assert.ok(testObject.enabled);
|
||||
@@ -257,7 +258,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(paged => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
|
||||
@@ -299,7 +300,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
assert.ok(testObject.enabled);
|
||||
@@ -329,7 +330,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
@@ -387,7 +388,7 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
const gallery = aGalleryExtension('a', { version: '1.0.0' });
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
assert.ok(!testObject.enabled);
|
||||
@@ -404,7 +405,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(extensions => {
|
||||
testObject.extension = extensions[0];
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier, version: local.manifest.version })));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(extensions => assert.ok(!testObject.enabled));
|
||||
});
|
||||
});
|
||||
@@ -419,7 +420,7 @@ suite('ExtensionsActions Test', () => {
|
||||
.then(extensions => {
|
||||
testObject.extension = extensions[0];
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', { identifier: local.identifier, version: '1.0.1' })));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(extensions => assert.ok(!testObject.enabled));
|
||||
});
|
||||
});
|
||||
@@ -442,7 +443,7 @@ suite('ExtensionsActions Test', () => {
|
||||
c();
|
||||
}
|
||||
});
|
||||
instantiationService.get(IExtensionsWorkbenchService).queryGallery();
|
||||
instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -458,7 +459,7 @@ suite('ExtensionsActions Test', () => {
|
||||
testObject.extension = extensions[0];
|
||||
const gallery = aGalleryExtension('a', { identifier: local.identifier, version: '1.0.1' });
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(extensions => {
|
||||
installEvent.fire({ identifier: local.identifier, gallery });
|
||||
assert.ok(!testObject.enabled);
|
||||
@@ -494,7 +495,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
testObject.extension = page.firstPage[0];
|
||||
assert.ok(!testObject.enabled);
|
||||
@@ -509,7 +510,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
testObject.extension = page.firstPage[0];
|
||||
|
||||
@@ -526,7 +527,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
testObject.extension = page.firstPage[0];
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
@@ -750,7 +751,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
const testObject: ExtensionsActions.EnableDropDownAction = instantiationService.createInstance(ExtensionsActions.EnableDropDownAction);
|
||||
testObject.extension = page.firstPage[0];
|
||||
@@ -762,7 +763,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
const testObject: ExtensionsActions.EnableDropDownAction = instantiationService.createInstance(ExtensionsActions.EnableDropDownAction);
|
||||
testObject.extension = page.firstPage[0];
|
||||
@@ -934,7 +935,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
const testObject: ExtensionsActions.DisableDropDownAction = instantiationService.createInstance(ExtensionsActions.DisableDropDownAction, [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
|
||||
testObject.extension = page.firstPage[0];
|
||||
@@ -946,7 +947,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then(page => {
|
||||
const testObject: ExtensionsActions.DisableDropDownAction = instantiationService.createInstance(ExtensionsActions.DisableDropDownAction, [{ identifier: new ExtensionIdentifier('pub.a'), extensionLocation: URI.file('pub.a') }]);
|
||||
testObject.extension = page.firstPage[0];
|
||||
@@ -998,7 +999,7 @@ suite('ExtensionsActions Test', () => {
|
||||
c();
|
||||
}
|
||||
});
|
||||
workbenchService.queryGallery();
|
||||
workbenchService.queryGallery(CancellationToken.None);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1020,7 +1021,7 @@ suite('ExtensionsActions Test', () => {
|
||||
c();
|
||||
}
|
||||
});
|
||||
workbenchService.queryGallery();
|
||||
workbenchService.queryGallery(CancellationToken.None);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1034,7 +1035,7 @@ suite('ExtensionsActions Test', () => {
|
||||
return workbenchService.queryLocal()
|
||||
.then(() => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(...gallery));
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then(() => {
|
||||
installEvent.fire({ identifier: local[0].identifier, gallery: gallery[0] });
|
||||
installEvent.fire({ identifier: local[1].identifier, gallery: gallery[1] });
|
||||
@@ -1056,7 +1057,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const workbenchService = instantiationService.get(IExtensionsWorkbenchService);
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return workbenchService.queryGallery()
|
||||
return workbenchService.queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
installEvent.fire({ identifier: gallery.identifier, gallery });
|
||||
@@ -1086,7 +1087,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery();
|
||||
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None);
|
||||
testObject.extension = paged.firstPage[0];
|
||||
assert.ok(!testObject.enabled);
|
||||
|
||||
@@ -1108,7 +1109,7 @@ suite('ExtensionsActions Test', () => {
|
||||
instantiationService.get(IExtensionsWorkbenchService).onChange(() => testObject.update());
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery()
|
||||
return instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None)
|
||||
.then((paged) => {
|
||||
testObject.extension = paged.firstPage[0];
|
||||
const identifier = gallery.identifier;
|
||||
@@ -1320,7 +1321,7 @@ suite('ExtensionsActions Test', () => {
|
||||
const gallery = aGalleryExtension('a');
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery();
|
||||
const paged = await instantiationService.get(IExtensionsWorkbenchService).queryGallery(CancellationToken.None);
|
||||
testObject.extension = paged.firstPage[0];
|
||||
assert.ok(!testObject.enabled);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import { IExperimentService, ExperimentService, ExperimentState, ExperimentActio
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
|
||||
import { ExtensionManagementServerService } from 'vs/workbench/services/extensions/electron-browser/extensionManagementServerService';
|
||||
import { ExtensionIdentifier, ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, ExtensionType, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
|
||||
|
||||
@@ -124,13 +124,13 @@ suite('ExtensionsListView Tests', () => {
|
||||
instantiationService.stubPromise(IExperimentService, 'getExperimentsByType', []);
|
||||
|
||||
instantiationService.stub(IExtensionService, {
|
||||
getExtensions: () => {
|
||||
getExtensions: (): Promise<IExtensionDescription[]> => {
|
||||
return Promise.resolve([
|
||||
{ identifier: new ExtensionIdentifier(localEnabledTheme.identifier.id) },
|
||||
{ identifier: new ExtensionIdentifier(localEnabledLanguage.identifier.id) },
|
||||
{ identifier: new ExtensionIdentifier(localRandom.identifier.id) },
|
||||
{ identifier: new ExtensionIdentifier(builtInTheme.identifier.id) },
|
||||
{ identifier: new ExtensionIdentifier(builtInBasic.identifier.id) }
|
||||
toExtensionDescription(localEnabledTheme),
|
||||
toExtensionDescription(localEnabledLanguage),
|
||||
toExtensionDescription(localRandom),
|
||||
toExtensionDescription(builtInTheme),
|
||||
toExtensionDescription(builtInBasic)
|
||||
]);
|
||||
}
|
||||
});
|
||||
@@ -185,8 +185,8 @@ suite('ExtensionsListView Tests', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('Test installed query results', () => {
|
||||
const allInstalledCheck = testableView.show('@installed').then(result => {
|
||||
test('Test installed query results', async () => {
|
||||
await testableView.show('@installed').then(result => {
|
||||
assert.equal(result.length, 5, 'Unexpected number of results for @installed query');
|
||||
const actual = [result.get(0).name, result.get(1).name, result.get(2).name, result.get(3).name, result.get(4).name].sort();
|
||||
const expected = [localDisabledTheme.manifest.name, localEnabledTheme.manifest.name, localRandom.manifest.name, localDisabledLanguage.manifest.name, localEnabledLanguage.manifest.name];
|
||||
@@ -195,125 +195,102 @@ suite('ExtensionsListView Tests', () => {
|
||||
}
|
||||
});
|
||||
|
||||
const installedCheck = testableView.show('@installed first').then(result => {
|
||||
await testableView.show('@installed first').then(result => {
|
||||
assert.equal(result.length, 2, 'Unexpected number of results for @installed query');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with search text.');
|
||||
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with search text.');
|
||||
});
|
||||
|
||||
const allDisabledCheck = testableView.show('@disabled').then(result => {
|
||||
await testableView.show('@disabled').then(result => {
|
||||
assert.equal(result.length, 2, 'Unexpected number of results for @disabled query');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @disabled query.');
|
||||
assert.equal(result.get(1).name, localDisabledLanguage.manifest.name, 'Unexpected extension for @disabled query.');
|
||||
});
|
||||
|
||||
const allEnabledCheck = testableView.show('@enabled').then(result => {
|
||||
await testableView.show('@enabled').then(result => {
|
||||
assert.equal(result.length, 3, 'Unexpected number of results for @enabled query');
|
||||
assert.equal(result.get(0).name, localEnabledTheme.manifest.name, 'Unexpected extension for @enabled query.');
|
||||
assert.equal(result.get(1).name, localRandom.manifest.name, 'Unexpected extension for @enabled query.');
|
||||
assert.equal(result.get(2).name, localEnabledLanguage.manifest.name, 'Unexpected extension for @enabled query.');
|
||||
});
|
||||
|
||||
const allBuiltinThemesCheck = testableView.show('@builtin:themes').then(result => {
|
||||
await testableView.show('@builtin:themes').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @builtin:themes query');
|
||||
assert.equal(result.get(0).name, builtInTheme.manifest.name, 'Unexpected extension for @builtin:themes query.');
|
||||
});
|
||||
|
||||
const allBuiltinBasicsCheck = testableView.show('@builtin:basics').then(result => {
|
||||
await testableView.show('@builtin:basics').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @builtin:basics query');
|
||||
assert.equal(result.get(0).name, builtInBasic.manifest.name, 'Unexpected extension for @builtin:basics query.');
|
||||
});
|
||||
|
||||
const allBuiltinCheck = testableView.show('@builtin').then(result => {
|
||||
await testableView.show('@builtin').then(result => {
|
||||
assert.equal(result.length, 2, 'Unexpected number of results for @builtin query');
|
||||
assert.equal(result.get(0).name, builtInBasic.manifest.name, 'Unexpected extension for @builtin query.');
|
||||
assert.equal(result.get(1).name, builtInTheme.manifest.name, 'Unexpected extension for @builtin query.');
|
||||
});
|
||||
|
||||
const builtinCheck = testableView.show('@builtin my-theme').then(result => {
|
||||
await testableView.show('@builtin my-theme').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @builtin query');
|
||||
assert.equal(result.get(0).name, builtInTheme.manifest.name, 'Unexpected extension for @builtin query.');
|
||||
});
|
||||
|
||||
return Promise.all([
|
||||
allInstalledCheck,
|
||||
installedCheck,
|
||||
allDisabledCheck,
|
||||
allEnabledCheck,
|
||||
allBuiltinThemesCheck,
|
||||
allBuiltinBasicsCheck,
|
||||
allBuiltinCheck,
|
||||
builtinCheck]);
|
||||
});
|
||||
|
||||
test('Test installed query with category', () => {
|
||||
const installedCategoryWithoutQuotesCheck = testableView.show('@installed category:themes').then(result => {
|
||||
test('Test installed query with category', async () => {
|
||||
await testableView.show('@installed category:themes').then(result => {
|
||||
assert.equal(result.length, 2, 'Unexpected number of results for @installed query with category');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with category.');
|
||||
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with category.');
|
||||
});
|
||||
|
||||
const installedCategoryWithQuotesCheck = testableView.show('@installed category:"themes"').then(result => {
|
||||
await testableView.show('@installed category:"themes"').then(result => {
|
||||
assert.equal(result.length, 2, 'Unexpected number of results for @installed query with quoted category');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with quoted category.');
|
||||
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with quoted category.');
|
||||
});
|
||||
|
||||
const installedCategoryWithSpaceCheck = testableView.show('@installed category:"programming languages"').then(result => {
|
||||
await testableView.show('@installed category:"programming languages"').then(result => {
|
||||
assert.equal(result.length, 2, 'Unexpected number of results for @installed query with quoted category including space');
|
||||
assert.equal(result.get(0).name, localDisabledLanguage.manifest.name, 'Unexpected extension for @installed query with quoted category inlcuding space.');
|
||||
assert.equal(result.get(1).name, localEnabledLanguage.manifest.name, 'Unexpected extension for @installed query with quoted category including space.');
|
||||
});
|
||||
|
||||
const installedMultipleCategoryCheck = testableView.show('@installed category:themes category:random').then(result => {
|
||||
await testableView.show('@installed category:themes category:random').then(result => {
|
||||
assert.equal(result.length, 3, 'Unexpected number of results for @installed query with multiple category');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @installed query with multiple category.');
|
||||
assert.equal(result.get(1).name, localEnabledTheme.manifest.name, 'Unexpected extension for @installed query with multiple category.');
|
||||
assert.equal(result.get(2).name, localRandom.manifest.name, 'Unexpected extension for @installed query with multiple category.');
|
||||
});
|
||||
|
||||
const enabledCategoryWithoutQuotesCheck = testableView.show('@enabled category:themes').then(result => {
|
||||
await testableView.show('@enabled category:themes').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @enabled query with category');
|
||||
assert.equal(result.get(0).name, localEnabledTheme.manifest.name, 'Unexpected extension for @enabled query with category.');
|
||||
});
|
||||
|
||||
const enabledCategoryWithQuotesCheck = testableView.show('@enabled category:"themes"').then(result => {
|
||||
await testableView.show('@enabled category:"themes"').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @enabled query with quoted category');
|
||||
assert.equal(result.get(0).name, localEnabledTheme.manifest.name, 'Unexpected extension for @enabled query with quoted category.');
|
||||
});
|
||||
|
||||
const enabledCategoryWithSpaceCheck = testableView.show('@enabled category:"programming languages"').then(result => {
|
||||
await testableView.show('@enabled category:"programming languages"').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @enabled query with quoted category inlcuding space');
|
||||
assert.equal(result.get(0).name, localEnabledLanguage.manifest.name, 'Unexpected extension for @enabled query with quoted category including space.');
|
||||
});
|
||||
|
||||
const disabledCategoryWithoutQuotesCheck = testableView.show('@disabled category:themes').then(result => {
|
||||
await testableView.show('@disabled category:themes').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @disabled query with category');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @disabled query with category.');
|
||||
});
|
||||
|
||||
const disabledCategoryWithQuotesCheck = testableView.show('@disabled category:"themes"').then(result => {
|
||||
await testableView.show('@disabled category:"themes"').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @disabled query with quoted category');
|
||||
assert.equal(result.get(0).name, localDisabledTheme.manifest.name, 'Unexpected extension for @disabled query with quoted category.');
|
||||
});
|
||||
|
||||
const disabledCategoryWithSpaceCheck = testableView.show('@disabled category:"programming languages"').then(result => {
|
||||
await testableView.show('@disabled category:"programming languages"').then(result => {
|
||||
assert.equal(result.length, 1, 'Unexpected number of results for @disabled query with quoted category inlcuding space');
|
||||
assert.equal(result.get(0).name, localDisabledLanguage.manifest.name, 'Unexpected extension for @disabled query with quoted category including space.');
|
||||
});
|
||||
|
||||
return Promise.resolve([
|
||||
installedCategoryWithoutQuotesCheck,
|
||||
installedCategoryWithQuotesCheck,
|
||||
installedCategoryWithSpaceCheck,
|
||||
installedMultipleCategoryCheck,
|
||||
enabledCategoryWithoutQuotesCheck,
|
||||
enabledCategoryWithQuotesCheck,
|
||||
enabledCategoryWithSpaceCheck,
|
||||
disabledCategoryWithoutQuotesCheck,
|
||||
disabledCategoryWithQuotesCheck,
|
||||
disabledCategoryWithSpaceCheck
|
||||
]);
|
||||
});
|
||||
|
||||
test('Test @recommended:workspace query', () => {
|
||||
@@ -523,5 +500,15 @@ suite('ExtensionsListView Tests', () => {
|
||||
function aPage<T>(...objects: T[]): IPager<T> {
|
||||
return { firstPage: objects, total: objects.length, pageSize: objects.length, getPage: () => null! };
|
||||
}
|
||||
|
||||
function toExtensionDescription(local: ILocalExtension): IExtensionDescription {
|
||||
return {
|
||||
identifier: new ExtensionIdentifier(local.identifier.id),
|
||||
isBuiltin: local.type === ExtensionType.System,
|
||||
isUnderDevelopment: false,
|
||||
extensionLocation: local.location,
|
||||
...local.manifest
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -70,10 +70,8 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
|
||||
instantiationService.stub(IWorkspaceContextService, new TestContextService());
|
||||
instantiationService.stub(IConfigurationService, {
|
||||
onDidUpdateConfiguration: () => { },
|
||||
onDidChangeConfiguration: () => { },
|
||||
getConfiguration: () => ({}),
|
||||
getValue: (key) => {
|
||||
onDidChangeConfiguration: () => { return undefined!; },
|
||||
getValue: (key?) => {
|
||||
return (key === AutoCheckUpdatesConfigurationKey || key === AutoUpdateConfigurationKey) ? true : undefined;
|
||||
}
|
||||
});
|
||||
@@ -91,7 +89,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
|
||||
instantiationService.set(IExtensionTipsService, instantiationService.createInstance(ExtensionTipsService));
|
||||
|
||||
instantiationService.stub(INotificationService, { prompt: () => null });
|
||||
instantiationService.stub(INotificationService, { prompt: () => null! });
|
||||
});
|
||||
|
||||
setup(async () => {
|
||||
@@ -133,7 +131,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
testObject = await aWorkbenchService();
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(expected));
|
||||
|
||||
return testObject.queryGallery().then(pagedResponse => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(pagedResponse => {
|
||||
assert.equal(1, pagedResponse.firstPage.length);
|
||||
const actual = pagedResponse.firstPage[0];
|
||||
|
||||
@@ -332,7 +330,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
testObject = await aWorkbenchService();
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
assert.equal(ExtensionState.Uninstalled, extension.state);
|
||||
|
||||
@@ -416,7 +414,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
const target = sinon.spy();
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
assert.equal(ExtensionState.Uninstalled, extension.state);
|
||||
|
||||
@@ -437,7 +435,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(gallery));
|
||||
const target = sinon.spy();
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
assert.equal(ExtensionState.Uninstalled, extension.state);
|
||||
|
||||
@@ -482,7 +480,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
testObject = await aWorkbenchService();
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a')));
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
return testObject.loadDependencies(page.firstPage[0], CancellationToken.None).then(dependencies => {
|
||||
assert.equal(null, dependencies);
|
||||
});
|
||||
@@ -494,7 +492,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.b', 'pub.c', 'pub.d'] })));
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('b'), aGalleryExtension('c'), aGalleryExtension('d')]);
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
|
||||
assert.ok(actual!.hasDependencies);
|
||||
@@ -533,7 +531,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.b', 'pub.a'] })));
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('b'), aGalleryExtension('a')]);
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
|
||||
assert.ok(actual!.hasDependencies);
|
||||
@@ -565,7 +563,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.b', 'pub.a'] })));
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('a')]);
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
|
||||
assert.ok(actual!.hasDependencies);
|
||||
@@ -599,7 +597,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a', {}, { dependencies: ['pub.inbuilt', 'pub.a'] })));
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'loadAllDependencies', [aGalleryExtension('a')]);
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
return testObject.loadDependencies(extension, CancellationToken.None).then(actual => {
|
||||
assert.ok(actual!.hasDependencies);
|
||||
@@ -637,7 +635,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
aGalleryExtension('d', {}, { dependencies: ['pub.f', 'pub.c'] }),
|
||||
aGalleryExtension('e')]);
|
||||
|
||||
return testObject.queryGallery().then(page => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(page => {
|
||||
const extension = page.firstPage[0];
|
||||
return testObject.loadDependencies(extension, CancellationToken.None).then(a => {
|
||||
assert.ok(a!.hasDependencies);
|
||||
@@ -726,7 +724,7 @@ suite('ExtensionsWorkbenchServiceTest', () => {
|
||||
.then(async () => {
|
||||
testObject = await aWorkbenchService();
|
||||
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage(aGalleryExtension('a')));
|
||||
return testObject.queryGallery().then(pagedResponse => {
|
||||
return testObject.queryGallery(CancellationToken.None).then(pagedResponse => {
|
||||
const actual = pagedResponse.firstPage[0];
|
||||
assert.equal(actual.enablementState, EnablementState.Enabled);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user