mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-28 15:50:29 -04:00
Await should() methods involving promises in tests. (#8876)
This commit is contained in:
@@ -56,7 +56,7 @@ describe('Manage Packages', () => {
|
||||
defaultLocation: 'invalid location'
|
||||
};
|
||||
let model = new ManagePackagesDialogModel(jupyterServerInstallation, providers, options);
|
||||
should(model.init()).rejectedWith(`Invalid default location '${options.defaultLocation}`);
|
||||
await should(model.init()).rejectedWith(`Invalid default location '${options.defaultLocation}`);
|
||||
});
|
||||
|
||||
it('Init should throw exception given invalid default provider', async function (): Promise<void> {
|
||||
@@ -70,9 +70,10 @@ describe('Manage Packages', () => {
|
||||
defaultProviderId: 'invalid provider'
|
||||
};
|
||||
let model = new ManagePackagesDialogModel(jupyterServerInstallation, providers, options);
|
||||
should(model.init()).rejectedWith(`Invalid default provider id '${options.defaultProviderId}`);
|
||||
await should(model.init()).rejectedWith(`Invalid default provider id '${options.defaultProviderId}`);
|
||||
});
|
||||
|
||||
/* Test disabled. Tracking issue: https://github.com/microsoft/azuredatastudio/issues/8877
|
||||
it('Init should throw exception not given valid default location for single location mode', async function (): Promise<void> {
|
||||
let testContext = createContext();
|
||||
let provider = createProvider(testContext);
|
||||
@@ -83,8 +84,9 @@ describe('Manage Packages', () => {
|
||||
multiLocations: false
|
||||
};
|
||||
let model = new ManagePackagesDialogModel(jupyterServerInstallation, providers, options);
|
||||
should(model.init()).rejectedWith(`Default location not specified for single location mode`);
|
||||
await should(model.init()).rejectedWith(`Default location not specified for single location mode`);
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
it('Init should set default options given undefined', async function (): Promise<void> {
|
||||
@@ -268,11 +270,12 @@ describe('Manage Packages', () => {
|
||||
let model = new ManagePackagesDialogModel(jupyterServerInstallation, providers, undefined);
|
||||
|
||||
should.equal(model.currentPackageManageProvider, undefined);
|
||||
should(model.listPackages()).rejected();
|
||||
should(model.installPackages(TypeMoq.It.isAny())).rejected();
|
||||
should(model.uninstallPackages(TypeMoq.It.isAny())).rejected();
|
||||
await should(model.listPackages()).rejected();
|
||||
await should(model.installPackages(TypeMoq.It.isAny())).rejected();
|
||||
await should(model.uninstallPackages(TypeMoq.It.isAny())).rejected();
|
||||
});
|
||||
|
||||
/* Test disabled. Tracking issue: https://github.com/microsoft/azuredatastudio/issues/8877
|
||||
it('current provider should install and uninstall packages successfully', async function (): Promise<void> {
|
||||
let testContext1 = createContext();
|
||||
testContext1.provider.providerId = 'providerId1';
|
||||
@@ -310,12 +313,14 @@ describe('Manage Packages', () => {
|
||||
|
||||
await model.init();
|
||||
model.changeProvider('providerId2');
|
||||
should(model.listPackages()).resolvedWith(packages);
|
||||
should(model.installPackages(packages)).resolved();
|
||||
should(model.uninstallPackages(packages)).resolved();
|
||||
should(model.getPackageOverview('p1')).resolved();
|
||||
should(model.getLocationTitle()).rejectedWith('location title 2');
|
||||
|
||||
await should(model.listPackages()).resolvedWith(packages);
|
||||
await should(model.installPackages(packages)).resolved();
|
||||
await should(model.uninstallPackages(packages)).resolved();
|
||||
await should(model.getPackageOverview('p1')).resolved();
|
||||
await should(model.getLocationTitle()).rejectedWith('location title 2');
|
||||
});
|
||||
*/
|
||||
|
||||
function createContext(): TestContext {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user