Replace deprecated assert functions in test files. (#16945)

This commit is contained in:
Cory Rivera
2021-08-31 09:04:17 -07:00
committed by GitHub
parent de3ff30398
commit 0082031f97
79 changed files with 1960 additions and 1965 deletions

View File

@@ -109,14 +109,14 @@ suite('Advanced options helper tests', () => {
categoryOption.isRequired = false;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadWrite');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0].text, '');
assert.equal(possibleInputs[1].text, 'ReadWrite');
assert.equal(possibleInputs[2].text, 'ReadOnly');
assert.equal(possibleInputs[0].value, '');
assert.equal(possibleInputs[1].value, 'RW');
assert.equal(possibleInputs[2].value, 'RO');
assert.strictEqual(optionValue, 'ReadWrite');
assert.strictEqual(possibleInputs.length, 3);
assert.strictEqual(possibleInputs[0].text, '');
assert.strictEqual(possibleInputs[1].text, 'ReadWrite');
assert.strictEqual(possibleInputs[2].text, 'ReadOnly');
assert.strictEqual(possibleInputs[0].value, '');
assert.strictEqual(possibleInputs[1].value, 'RW');
assert.strictEqual(possibleInputs[2].value, 'RO');
});
test('create default and required category options should set the option value and possible inputs correctly', () => {
@@ -124,10 +124,10 @@ suite('Advanced options helper tests', () => {
categoryOption.isRequired = true;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadWrite');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0].text, 'ReadWrite');
assert.equal(possibleInputs[1].text, 'ReadOnly');
assert.strictEqual(optionValue, 'ReadWrite');
assert.strictEqual(possibleInputs.length, 2);
assert.strictEqual(possibleInputs[0].text, 'ReadWrite');
assert.strictEqual(possibleInputs[1].text, 'ReadOnly');
});
test('create no default and not required category options should set the option value and possible inputs correctly', () => {
@@ -135,11 +135,11 @@ suite('Advanced options helper tests', () => {
categoryOption.isRequired = false;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, '');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0].text, '');
assert.equal(possibleInputs[1].text, 'ReadWrite');
assert.equal(possibleInputs[2].text, 'ReadOnly');
assert.strictEqual(optionValue, '');
assert.strictEqual(possibleInputs.length, 3);
assert.strictEqual(possibleInputs[0].text, '');
assert.strictEqual(possibleInputs[1].text, 'ReadWrite');
assert.strictEqual(possibleInputs[2].text, 'ReadOnly');
});
test('create no default but required category options should set the option value and possible inputs correctly', () => {
@@ -147,10 +147,10 @@ suite('Advanced options helper tests', () => {
categoryOption.isRequired = true;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadWrite');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0].text, 'ReadWrite');
assert.equal(possibleInputs[1].text, 'ReadOnly');
assert.strictEqual(optionValue, 'ReadWrite');
assert.strictEqual(possibleInputs.length, 2);
assert.strictEqual(possibleInputs[0].text, 'ReadWrite');
assert.strictEqual(possibleInputs[1].text, 'ReadOnly');
});
test('create not required category options with option value should set the option value and possible inputs correctly', () => {
@@ -159,11 +159,11 @@ suite('Advanced options helper tests', () => {
possibleInputs = [];
options['applicationIntent'] = 'ReadOnly';
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadOnly');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0].text, '');
assert.equal(possibleInputs[1].text, 'ReadWrite');
assert.equal(possibleInputs[2].text, 'ReadOnly');
assert.strictEqual(optionValue, 'ReadOnly');
assert.strictEqual(possibleInputs.length, 3);
assert.strictEqual(possibleInputs[0].text, '');
assert.strictEqual(possibleInputs[1].text, 'ReadWrite');
assert.strictEqual(possibleInputs[2].text, 'ReadOnly');
});
test('create required category options with option value should set the option value and possible inputs correctly', () => {
@@ -172,10 +172,10 @@ suite('Advanced options helper tests', () => {
possibleInputs = [];
options['applicationIntent'] = 'ReadOnly';
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(categoryOption, options, possibleInputs);
assert.equal(optionValue, 'ReadOnly');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0].text, 'ReadWrite');
assert.equal(possibleInputs[1].text, 'ReadOnly');
assert.strictEqual(optionValue, 'ReadOnly');
assert.strictEqual(possibleInputs.length, 2);
assert.strictEqual(possibleInputs[0].text, 'ReadWrite');
assert.strictEqual(possibleInputs[1].text, 'ReadOnly');
});
test('create default but not required boolean options should set the option value and possible inputs correctly', () => {
@@ -183,11 +183,11 @@ suite('Advanced options helper tests', () => {
booleanOption.isRequired = false;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'False');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0].text, '');
assert.equal(possibleInputs[1].text, 'True');
assert.equal(possibleInputs[2].text, 'False');
assert.strictEqual(optionValue, 'False');
assert.strictEqual(possibleInputs.length, 3);
assert.strictEqual(possibleInputs[0].text, '');
assert.strictEqual(possibleInputs[1].text, 'True');
assert.strictEqual(possibleInputs[2].text, 'False');
});
test('create default and required boolean options should set the option value and possible inputs correctly', () => {
@@ -195,10 +195,10 @@ suite('Advanced options helper tests', () => {
booleanOption.isRequired = true;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'False');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0].text, 'True');
assert.equal(possibleInputs[1].text, 'False');
assert.strictEqual(optionValue, 'False');
assert.strictEqual(possibleInputs.length, 2);
assert.strictEqual(possibleInputs[0].text, 'True');
assert.strictEqual(possibleInputs[1].text, 'False');
});
test('create no default and not required boolean options should set the option value and possible inputs correctly', () => {
@@ -206,11 +206,11 @@ suite('Advanced options helper tests', () => {
booleanOption.isRequired = false;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, '');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0].text, '');
assert.equal(possibleInputs[1].text, 'True');
assert.equal(possibleInputs[2].text, 'False');
assert.strictEqual(optionValue, '');
assert.strictEqual(possibleInputs.length, 3);
assert.strictEqual(possibleInputs[0].text, '');
assert.strictEqual(possibleInputs[1].text, 'True');
assert.strictEqual(possibleInputs[2].text, 'False');
});
test('create no default but required boolean options should set the option value and possible inputs correctly', () => {
@@ -218,10 +218,10 @@ suite('Advanced options helper tests', () => {
booleanOption.isRequired = true;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'True');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0].text, 'True');
assert.equal(possibleInputs[1].text, 'False');
assert.strictEqual(optionValue, 'True');
assert.strictEqual(possibleInputs.length, 2);
assert.strictEqual(possibleInputs[0].text, 'True');
assert.strictEqual(possibleInputs[1].text, 'False');
});
test('create not required boolean options with option value should set the option value and possible inputs correctly', () => {
@@ -230,11 +230,11 @@ suite('Advanced options helper tests', () => {
possibleInputs = [];
options['asynchronousProcessing'] = true;
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'True');
assert.equal(possibleInputs.length, 3);
assert.equal(possibleInputs[0].text, '');
assert.equal(possibleInputs[1].text, 'True');
assert.equal(possibleInputs[2].text, 'False');
assert.strictEqual(optionValue, 'True');
assert.strictEqual(possibleInputs.length, 3);
assert.strictEqual(possibleInputs[0].text, '');
assert.strictEqual(possibleInputs[1].text, 'True');
assert.strictEqual(possibleInputs[2].text, 'False');
});
test('create required boolean options with option value should set the option value and possible inputs correctly', () => {
@@ -243,10 +243,10 @@ suite('Advanced options helper tests', () => {
possibleInputs = [];
options['asynchronousProcessing'] = 'False';
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(booleanOption, options, possibleInputs);
assert.equal(optionValue, 'False');
assert.equal(possibleInputs.length, 2);
assert.equal(possibleInputs[0].text, 'True');
assert.equal(possibleInputs[1].text, 'False');
assert.strictEqual(optionValue, 'False');
assert.strictEqual(possibleInputs.length, 2);
assert.strictEqual(possibleInputs[0].text, 'True');
assert.strictEqual(possibleInputs[1].text, 'False');
});
test('create default number options should set the option value and possible inputs correctly', () => {
@@ -254,7 +254,7 @@ suite('Advanced options helper tests', () => {
numberOption.isRequired = true;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(numberOption, options, possibleInputs);
assert.equal(optionValue, '15');
assert.strictEqual(optionValue, '15');
});
test('create number options with option value should set the option value and possible inputs correctly', () => {
@@ -263,7 +263,7 @@ suite('Advanced options helper tests', () => {
possibleInputs = [];
options['connectTimeout'] = '45';
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(numberOption, options, possibleInputs);
assert.equal(optionValue, '45');
assert.strictEqual(optionValue, '45');
});
test('create default string options should set the option value and possible inputs correctly', () => {
@@ -271,7 +271,7 @@ suite('Advanced options helper tests', () => {
stringOption.isRequired = true;
possibleInputs = [];
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(stringOption, options, possibleInputs);
assert.equal(optionValue, 'Japanese');
assert.strictEqual(optionValue, 'Japanese');
});
test('create string options with option value should set the option value and possible inputs correctly', () => {
@@ -280,7 +280,7 @@ suite('Advanced options helper tests', () => {
possibleInputs = [];
options['currentLanguage'] = 'Spanish';
let optionValue = OptionsDialogHelper.getOptionValueAndCategoryValues(stringOption, options, possibleInputs);
assert.equal(optionValue, 'Spanish');
assert.strictEqual(optionValue, 'Spanish');
});
test('validate undefined and optional number input should return no error', () => {
@@ -295,7 +295,7 @@ suite('Advanced options helper tests', () => {
};
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, true);
assert.strictEqual(error, true);
});
test('validate a valid optional number input should return no error', () => {
@@ -310,7 +310,7 @@ suite('Advanced options helper tests', () => {
};
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, true);
assert.strictEqual(error, true);
});
test('validate a valid required number input should return no error', () => {
@@ -324,7 +324,7 @@ suite('Advanced options helper tests', () => {
optionValue: null
};
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, true);
assert.strictEqual(error, true);
});
test('validate invalid optional number option should return an expected error', () => {
@@ -339,7 +339,7 @@ suite('Advanced options helper tests', () => {
};
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, false);
assert.strictEqual(error, false);
});
test('validate required optional number option should return an expected error', () => {
@@ -354,7 +354,7 @@ suite('Advanced options helper tests', () => {
};
let error = OptionsDialogHelper.validateInputs(optionsMap);
assert.equal(error, false);
assert.strictEqual(error, false);
});
test('update options should delete option entry if the input value is an empty string', () => {
@@ -369,7 +369,7 @@ suite('Advanced options helper tests', () => {
};
options['connectTimeout'] = '45';
OptionsDialogHelper.updateOptions(options, optionsMap);
assert.equal(options['connectTimeout'], undefined);
assert.strictEqual(options['connectTimeout'], undefined);
});
test('update options should update correct option value', () => {
@@ -384,7 +384,7 @@ suite('Advanced options helper tests', () => {
};
options['connectTimeout'] = '45';
OptionsDialogHelper.updateOptions(options, optionsMap);
assert.equal(options['connectTimeout'], 50);
assert.strictEqual(options['connectTimeout'], '50');
});
test('update options should add the option value to options', () => {
@@ -399,18 +399,18 @@ suite('Advanced options helper tests', () => {
};
options = {};
OptionsDialogHelper.updateOptions(options, optionsMap);
assert.equal(options['connectTimeout'], 50);
assert.strictEqual(options['connectTimeout'], '50');
});
test('groupOptionsByCategory converts a list of options to a map of category names to lists of options', () => {
let optionsList = [categoryOption, booleanOption, numberOption, stringOption, defaultGroupOption];
let optionsMap = OptionsDialogHelper.groupOptionsByCategory(optionsList);
let categoryNames = Object.keys(optionsMap);
assert.equal(categoryNames.some(x => x === 'Initialization'), true);
assert.equal(categoryNames.some(x => x === 'General'), true);
assert.equal(categoryNames.length, 2);
assert.equal(optionsMap['Initialization'].length, 4);
assert.equal(optionsMap['General'].length, 1);
assert.strictEqual(categoryNames.some(x => x === 'Initialization'), true);
assert.strictEqual(categoryNames.some(x => x === 'General'), true);
assert.strictEqual(categoryNames.length, 2);
assert.strictEqual(optionsMap['Initialization'].length, 4);
assert.strictEqual(optionsMap['General'].length, 1);
});
});

View File

@@ -27,7 +27,7 @@ suite('TaskUtilities', function () {
// If I call getCurrentGlobalConnection, it should return the expected server profile
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
assert.equal(actualProfile, expectedProfile);
assert.strictEqual(actualProfile, expectedProfile);
});
test('getCurrentGlobalConnection returns the selected OE database if a database or its children is selected', () => {
@@ -45,13 +45,13 @@ suite('TaskUtilities', function () {
// If I call getCurrentGlobalConnection, it should return the expected database profile
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
assert.equal(actualProfile.databaseName, dbName);
assert.notEqual(actualProfile.id, serverProfile.id);
assert.strictEqual(actualProfile.databaseName, dbName);
assert.notStrictEqual(actualProfile.id, serverProfile.id);
// Other connection attributes still match
assert.equal(actualProfile.authenticationType, serverProfile.authenticationType);
assert.equal(actualProfile.password, serverProfile.password);
assert.equal(actualProfile.serverName, serverProfile.serverName);
assert.equal(actualProfile.userName, serverProfile.userName);
assert.strictEqual(actualProfile.authenticationType, serverProfile.authenticationType);
assert.strictEqual(actualProfile.password, serverProfile.password);
assert.strictEqual(actualProfile.serverName, serverProfile.serverName);
assert.strictEqual(actualProfile.userName, serverProfile.userName);
});
test('getCurrentGlobalConnection returns the connection from the active tab, if there is one and OE is not focused', () => {
@@ -76,11 +76,11 @@ suite('TaskUtilities', function () {
// If I call getCurrentGlobalConnection, it should return the expected profile from the active tab
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
assert.equal(actualProfile.databaseName, tabProfile.databaseName);
assert.equal(actualProfile.authenticationType, tabProfile.authenticationType);
assert.equal(actualProfile.password, tabProfile.password);
assert.equal(actualProfile.serverName, tabProfile.serverName);
assert.equal(actualProfile.userName, tabProfile.userName);
assert.strictEqual(actualProfile.databaseName, tabProfile.databaseName);
assert.strictEqual(actualProfile.authenticationType, tabProfile.authenticationType);
assert.strictEqual(actualProfile.password, tabProfile.password);
assert.strictEqual(actualProfile.serverName, tabProfile.serverName);
assert.strictEqual(actualProfile.userName, tabProfile.userName);
});
test('getCurrentGlobalConnection returns the connection from OE if there is no active tab, even if OE is not focused', () => {
@@ -97,6 +97,6 @@ suite('TaskUtilities', function () {
// If I call getCurrentGlobalConnection, it should return the expected profile from OE
let actualProfile = TaskUtilities.getCurrentGlobalConnection(mockObjectExplorerService.object, mockConnectionManagementService.object, mockWorkbenchEditorService.object);
assert.equal(actualProfile, oeProfile);
assert.strictEqual(actualProfile, oeProfile);
});
});

View File

@@ -14,12 +14,12 @@ suite('Grid Table State', () => {
const batchId = 0;
const state = new GridTableState(resultId, batchId);
assert.equal(state.resultId, resultId);
assert.equal(state.batchId, batchId);
assert.strictEqual(state.resultId, resultId);
assert.strictEqual(state.batchId, batchId);
assert(isUndefined(state.canBeMaximized));
assert(isUndefined(state.maximized));
assert.equal(state.scrollPositionX, 0);
assert.equal(state.scrollPositionY, 0);
assert.strictEqual(state.scrollPositionX, 0);
assert.strictEqual(state.scrollPositionY, 0);
assert(isUndefined(state.columnSizes));
assert(isUndefined(state.selection));
assert(isUndefined(state.activeCell));
@@ -32,31 +32,31 @@ suite('Grid Table State', () => {
state.canBeMaximized = true;
});
assert.equal(event, true);
assert.equal(state.canBeMaximized, true);
assert.strictEqual(event, true);
assert.strictEqual(state.canBeMaximized, true);
event = await new Promise<boolean>(resolve => {
Event.once(state.onCanBeMaximizedChange)(e => resolve(e));
state.canBeMaximized = false;
});
assert.equal(event, false);
assert.equal(state.canBeMaximized, false);
assert.strictEqual(event, false);
assert.strictEqual(state.canBeMaximized, false);
event = await new Promise<boolean>(resolve => {
Event.once(state.onMaximizedChange)(e => resolve(e));
state.maximized = true;
});
assert.equal(event, true);
assert.equal(state.maximized, true);
assert.strictEqual(event, true);
assert.strictEqual(state.maximized, true);
event = await new Promise<boolean>(resolve => {
Event.once(state.onMaximizedChange)(e => resolve(e));
state.maximized = false;
});
assert.equal(event, false);
assert.equal(state.maximized, false);
assert.strictEqual(event, false);
assert.strictEqual(state.maximized, false);
});
});

View File

@@ -65,7 +65,7 @@ suite('ExtHostAccountManagement', () => {
let extHost = new ExtHostAccountManagement(threadService);
// Then: There shouldn't be any account providers registered
assert.equal(extHost.getProviderCount(), 0);
assert.strictEqual(extHost.getProviderCount(), 0);
});
// REGISTER TESTS //////////////////////////////////////////////////////
@@ -78,7 +78,7 @@ suite('ExtHostAccountManagement', () => {
extHost.$registerAccountProvider(mockAccountMetadata, mockProvider.object);
// Then: The account provider should be registered
assert.equal(extHost.getProviderCount(), 1);
assert.strictEqual(extHost.getProviderCount(), 1);
});
test('Register Account Provider - Account Provider Already Registered', () => {
@@ -95,7 +95,7 @@ suite('ExtHostAccountManagement', () => {
});
// ... There should only be one account provider
assert.equal(extHost.getProviderCount(), 1);
assert.strictEqual(extHost.getProviderCount(), 1);
});
// TODO: Test for unregistering a provider
@@ -310,7 +310,7 @@ suite('ExtHostAccountManagement', () => {
);
assert.ok(Array.isArray(accounts));
assert.equal(accounts.length, expectedAccounts.length);
assert.strictEqual(accounts.length, expectedAccounts.length);
assert.deepStrictEqual(accounts, expectedAccounts);
});
});

View File

@@ -41,7 +41,7 @@ suite('ExtHostCredentialManagement', () => {
let extHost = new ExtHostCredentialManagement(threadService);
// Then: The extension host should not have any providers registered
assert.equal(extHost.getProviderCount(), 0);
assert.strictEqual(extHost.getProviderCount(), 0);
});
test('Register Credential Provider', () => {
@@ -53,7 +53,7 @@ suite('ExtHostCredentialManagement', () => {
extHost.$registerCredentialProvider(mockCredentialProvider);
// Then: There should be one provider registered
assert.equal(extHost.getProviderCount(), 1);
assert.strictEqual(extHost.getProviderCount(), 1);
});
test('Get Credential Provider - Success', () => {
@@ -71,7 +71,7 @@ suite('ExtHostCredentialManagement', () => {
return extHost.$getCredentialProvider(namespaceId)
.then((provider) => {
// Then: There should still only be one provider registered
assert.equal(extHost.getProviderCount(), 1);
assert.strictEqual(extHost.getProviderCount(), 1);
credProvider = provider;
})
.then(() => {
@@ -81,8 +81,8 @@ suite('ExtHostCredentialManagement', () => {
.then(() => {
// Then: The credential should have been stored with its namespace
assert.notStrictEqual(mockCredentialProvider.storedCredentials[expectedCredentialId], undefined);
assert.equal(mockCredentialProvider.storedCredentials[expectedCredentialId].credentialId, expectedCredentialId);
assert.equal(mockCredentialProvider.storedCredentials[expectedCredentialId].password, credential);
assert.strictEqual(mockCredentialProvider.storedCredentials[expectedCredentialId].credentialId, expectedCredentialId);
assert.strictEqual(mockCredentialProvider.storedCredentials[expectedCredentialId].password, credential);
})
.then(() => {
// If: I read a credential
@@ -90,8 +90,8 @@ suite('ExtHostCredentialManagement', () => {
})
.then((returnedCredential: Credential) => {
// Then: The credential ID should be namespaced
assert.equal(returnedCredential.credentialId, expectedCredentialId);
assert.equal(returnedCredential.password, credential);
assert.strictEqual(returnedCredential.credentialId, expectedCredentialId);
assert.strictEqual(returnedCredential.password, credential);
})
.then(() => {
// If: I delete a credential

View File

@@ -52,10 +52,10 @@ suite('ExtHostDataProtocol', () => {
let allProviders = extHostDataProtocol.getProvidersByType<azdata.MetadataProvider>(DataProviderType.MetadataProvider);
// Then each provider was retrieved successfully
assert.equal(retrievedProvider1, extension1MetadataMock.object, 'Expected metadata provider was not retrieved for extension 1');
assert.equal(retrievedProvider2, extension2MetadataMock.object, 'Expected metadata provider was not retrieved for extension 2');
assert.equal(allProviders.length, 2, 'All metadata providers had unexpected length');
assert.equal(allProviders.some(provider => provider === extension1MetadataMock.object), true, 'All metadata providers did not include extension 1 metadata provider');
assert.equal(allProviders.some(provider => provider === extension2MetadataMock.object), true, 'All metadata providers did not include extension 2 metadata provider');
assert.strictEqual(retrievedProvider1, extension1MetadataMock.object, 'Expected metadata provider was not retrieved for extension 1');
assert.strictEqual(retrievedProvider2, extension2MetadataMock.object, 'Expected metadata provider was not retrieved for extension 2');
assert.strictEqual(allProviders.length, 2, 'All metadata providers had unexpected length');
assert.strictEqual(allProviders.some(provider => provider === extension1MetadataMock.object), true, 'All metadata providers did not include extension 1 metadata provider');
assert.strictEqual(allProviders.some(provider => provider === extension2MetadataMock.object), true, 'All metadata providers did not include extension 2 metadata provider');
});
});

View File

@@ -78,14 +78,14 @@ suite('ExtHostModelView Validation Tests', () => {
test('The custom validation output of a component gets set when it is initialized', () => {
return extHostModelView.$runCustomValidations(handle, inputBox.id).then(valid => {
assert.equal(valid, false, 'Empty input box did not validate as false');
assert.strictEqual(valid, false, 'Empty input box did not validate as false');
});
});
test('The custom validation output of a component changes if its value changes', () => {
inputBox.value = validText;
return extHostModelView.$runCustomValidations(handle, inputBox.id).then(valid => {
assert.equal(valid, true, 'Valid input box did not validate as valid');
assert.strictEqual(valid, true, 'Valid input box did not validate as valid');
});
});
@@ -97,22 +97,22 @@ suite('ExtHostModelView Validation Tests', () => {
eventType: ComponentEventType.PropertiesChanged
} as IComponentEventArgs);
return extHostModelView.$runCustomValidations(handle, inputBox.id).then(valid => {
assert.equal(valid, true, 'Valid input box did not validate as valid after PropertiesChanged event');
assert.strictEqual(valid, true, 'Valid input box did not validate as valid after PropertiesChanged event');
});
});
test('The validity of a component is set by main thread validationChanged events', () => {
assert.equal(inputBox.valid, true, 'Component validity is true by default');
assert.strictEqual(inputBox.valid, true, 'Component validity is true by default');
extHostModelView.$handleEvent(handle, inputBox.id, {
eventType: ComponentEventType.validityChanged,
args: false
});
assert.equal(inputBox.valid, false, 'Input box did not update validity to false based on the validityChanged event');
assert.strictEqual(inputBox.valid, false, 'Input box did not update validity to false based on the validityChanged event');
extHostModelView.$handleEvent(handle, inputBox.id, {
eventType: ComponentEventType.validityChanged,
args: true
});
assert.equal(inputBox.valid, true, 'Input box did not update validity to true based on the validityChanged event');
assert.strictEqual(inputBox.valid, true, 'Input box did not update validity to true based on the validityChanged event');
});
test('Main thread validityChanged events cause component to fire validity changed events', () => {
@@ -122,7 +122,7 @@ suite('ExtHostModelView Validation Tests', () => {
eventType: ComponentEventType.validityChanged,
args: false
});
assert.equal(validityFromEvent, false, 'Main thread validityChanged event did not cause component to fire its own event');
assert.strictEqual(validityFromEvent, false, 'Main thread validityChanged event did not cause component to fire its own event');
});
test('Setting a form component as required initializes the model with the component required', () => {
@@ -186,26 +186,26 @@ suite('ExtHostModelView Validation Tests', () => {
modelView.initializeModel(formContainer);
// Then all the items plus a group label are added and have the correct layouts
assert.equal(rootComponent.itemConfigs.length, 4);
assert.strictEqual(rootComponent.itemConfigs.length, 4);
let listBoxConfig = rootComponent.itemConfigs[0];
let groupLabelConfig = rootComponent.itemConfigs[1];
let inputBoxConfig = rootComponent.itemConfigs[2];
let dropdownConfig = rootComponent.itemConfigs[3];
// Verify that the correct items were added
assert.equal(listBoxConfig.componentShape.type, ModelComponentTypes.ListBox, `Unexpected ModelComponentType. Expected ListBox but got ${ModelComponentTypes[listBoxConfig.componentShape.type]}`);
assert.equal(groupLabelConfig.componentShape.type, ModelComponentTypes.Text, `Unexpected ModelComponentType. Expected Text but got ${ModelComponentTypes[groupLabelConfig.componentShape.type]}`);
assert.equal(inputBoxConfig.componentShape.type, ModelComponentTypes.InputBox, `Unexpected ModelComponentType. Expected InputBox but got ${ModelComponentTypes[inputBoxConfig.componentShape.type]}`);
assert.equal(dropdownConfig.componentShape.type, ModelComponentTypes.DropDown, `Unexpected ModelComponentType. Expected DropDown but got ${ModelComponentTypes[dropdownConfig.componentShape.type]}`);
assert.strictEqual(listBoxConfig.componentShape.type, ModelComponentTypes.ListBox, `Unexpected ModelComponentType. Expected ListBox but got ${ModelComponentTypes[listBoxConfig.componentShape.type]}`);
assert.strictEqual(groupLabelConfig.componentShape.type, ModelComponentTypes.Text, `Unexpected ModelComponentType. Expected Text but got ${ModelComponentTypes[groupLabelConfig.componentShape.type]}`);
assert.strictEqual(inputBoxConfig.componentShape.type, ModelComponentTypes.InputBox, `Unexpected ModelComponentType. Expected InputBox but got ${ModelComponentTypes[inputBoxConfig.componentShape.type]}`);
assert.strictEqual(dropdownConfig.componentShape.type, ModelComponentTypes.DropDown, `Unexpected ModelComponentType. Expected DropDown but got ${ModelComponentTypes[dropdownConfig.componentShape.type]}`);
// Verify that the group title was set up correctly
assert.equal(groupLabelConfig.componentShape.properties['value'], groupTitle, `Unexpected title. Expected ${groupTitle} but got ${groupLabelConfig.componentShape.properties['value']}`);
assert.equal((groupLabelConfig.config as TitledFormItemLayout).isGroupLabel, true, `Unexpected value for isGroupLabel. Expected true but got ${(groupLabelConfig.config as TitledFormItemLayout).isGroupLabel}`);
assert.strictEqual(groupLabelConfig.componentShape.properties['value'], groupTitle, `Unexpected title. Expected ${groupTitle} but got ${groupLabelConfig.componentShape.properties['value']}`);
assert.strictEqual((groupLabelConfig.config as TitledFormItemLayout).isGroupLabel, true, `Unexpected value for isGroupLabel. Expected true but got ${(groupLabelConfig.config as TitledFormItemLayout).isGroupLabel}`);
// Verify that the components' layouts are correct
assert.equal((listBoxConfig.config as azdata.FormItemLayout).horizontal, defaultLayout.horizontal, `Unexpected layout for listBoxConfig. Expected defaultLayout.horizontal but got ${(listBoxConfig.config as azdata.FormItemLayout).horizontal}`);
assert.equal((inputBoxConfig.config as azdata.FormItemLayout).horizontal, groupInputLayout.horizontal, `Unexpected layout for inputBoxConfig. Expected groupInputLayout.horizontal but got ${(inputBoxConfig.config as azdata.FormItemLayout).horizontal}`);
assert.equal((dropdownConfig.config as azdata.FormItemLayout).horizontal, defaultLayout.horizontal, `Unexpected layout for dropdownConfig. Expected defaultLayout.horizontal but got ${(dropdownConfig.config as azdata.FormItemLayout).horizontal}`);
assert.strictEqual((listBoxConfig.config as azdata.FormItemLayout).horizontal, defaultLayout.horizontal, `Unexpected layout for listBoxConfig. Expected defaultLayout.horizontal but got ${(listBoxConfig.config as azdata.FormItemLayout).horizontal}`);
assert.strictEqual((inputBoxConfig.config as azdata.FormItemLayout).horizontal, groupInputLayout.horizontal, `Unexpected layout for inputBoxConfig. Expected groupInputLayout.horizontal but got ${(inputBoxConfig.config as azdata.FormItemLayout).horizontal}`);
assert.strictEqual((dropdownConfig.config as azdata.FormItemLayout).horizontal, defaultLayout.horizontal, `Unexpected layout for dropdownConfig. Expected defaultLayout.horizontal but got ${(dropdownConfig.config as azdata.FormItemLayout).horizontal}`);
});
test('Inserting and removing components from a container should work correctly', () => {
@@ -221,13 +221,13 @@ suite('ExtHostModelView Validation Tests', () => {
modelView.initializeModel(flex);
const itemConfigs: InternalItemConfig[] = (flex as IWithItemConfig).itemConfigs;
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
flex.insertItem(dropDown, 1);
assert.equal(itemConfigs.length, 3, `Unexpected number of items in list. Expected 3, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.equal(itemConfigs[1].toIItemConfig().componentShape.type, ModelComponentTypes.DropDown, `Unexpected ModelComponentType. Expected DropDown but got ${ModelComponentTypes[itemConfigs[1].toIItemConfig().componentShape.type]}`);
assert.strictEqual(itemConfigs.length, 3, `Unexpected number of items in list. Expected 3, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs[1].toIItemConfig().componentShape.type, ModelComponentTypes.DropDown, `Unexpected ModelComponentType. Expected DropDown but got ${ModelComponentTypes[itemConfigs[1].toIItemConfig().componentShape.type]}`);
flex.removeItem(listBox);
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.equal(itemConfigs[0].toIItemConfig().componentShape.type, ModelComponentTypes.DropDown, `Unexpected ModelComponentType. Expected DropDown but got ${ModelComponentTypes[itemConfigs[0].toIItemConfig().componentShape.type]}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs[0].toIItemConfig().componentShape.type, ModelComponentTypes.DropDown, `Unexpected ModelComponentType. Expected DropDown but got ${ModelComponentTypes[itemConfigs[0].toIItemConfig().componentShape.type]}`);
});
test('Inserting component give negative number fails', () => {
@@ -244,7 +244,7 @@ suite('ExtHostModelView Validation Tests', () => {
modelView.initializeModel(flex);
const itemConfigs: InternalItemConfig[] = (flex as IWithItemConfig).itemConfigs;
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.throws(() => flex.insertItem(dropDown, -1), `Didn't get expected exception when calling insertItem with invalid index -1`);
});
@@ -262,7 +262,7 @@ suite('ExtHostModelView Validation Tests', () => {
modelView.initializeModel(flex);
const itemConfigs: InternalItemConfig[] = (flex as IWithItemConfig).itemConfigs;
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.throws(() => flex.insertItem(dropDown, 10), `Didn't get expected exception when calling insertItem with invalid index 10`);
});
@@ -280,9 +280,9 @@ suite('ExtHostModelView Validation Tests', () => {
modelView.initializeModel(flex);
const itemConfigs: InternalItemConfig[] = (flex as IWithItemConfig).itemConfigs;
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
flex.insertItem(dropDown, 2);
assert.equal(itemConfigs.length, 3, `Unexpected number of items in list. Expected 3, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 3, `Unexpected number of items in list. Expected 3, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
});
test('Removing a component that does not exist does not fail', () => {
@@ -300,9 +300,9 @@ suite('ExtHostModelView Validation Tests', () => {
const itemConfigs: InternalItemConfig[] = (flex as IWithItemConfig).itemConfigs;
let result = flex.removeItem(dropDown);
assert.equal(result, false);
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.equal(itemConfigs[0].toIItemConfig().componentShape.type, ModelComponentTypes.ListBox, `Unexpected ModelComponentType. Expected ListBox but got ${ModelComponentTypes[itemConfigs[0].toIItemConfig().componentShape.type]}`);
assert.strictEqual(result, false);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs[0].toIItemConfig().componentShape.type, ModelComponentTypes.ListBox, `Unexpected ModelComponentType. Expected ListBox but got ${ModelComponentTypes[itemConfigs[0].toIItemConfig().componentShape.type]}`);
});
@@ -342,19 +342,19 @@ suite('ExtHostModelView Validation Tests', () => {
modelView.initializeModel(formBuilder.component());
const itemConfigs: InternalItemConfig[] = (form as IWithItemConfig).itemConfigs;
assert.equal(itemConfigs.length, 1);
assert.strictEqual(itemConfigs.length, 1);
formBuilder.insertFormItem(inputBoxFormItem, 0);
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.equal(itemConfigs[0].toIItemConfig().componentShape.type, ModelComponentTypes.InputBox, `Unexpected ModelComponentType. Expected InputBox but got ${ModelComponentTypes[itemConfigs[0].toIItemConfig().componentShape.type]}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs[0].toIItemConfig().componentShape.type, ModelComponentTypes.InputBox, `Unexpected ModelComponentType. Expected InputBox but got ${ModelComponentTypes[itemConfigs[0].toIItemConfig().componentShape.type]}`);
formBuilder.insertFormItem(groupItems, 0);
assert.equal(itemConfigs.length, 5, `Unexpected number of items in list. Expected 5, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 5, `Unexpected number of items in list. Expected 5, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
formBuilder.removeFormItem(listBoxFormItem);
assert.equal(itemConfigs.length, 4, `Unexpected number of items in list. Expected 4, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 4, `Unexpected number of items in list. Expected 4, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
formBuilder.removeFormItem(groupItems);
assert.equal(itemConfigs.length, 1, `Unexpected number of items in list. Expected 1, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs.length, 1, `Unexpected number of items in list. Expected 1, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
formBuilder.addFormItem(listBoxFormItem);
assert.equal(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.equal(itemConfigs[1].toIItemConfig().componentShape.type, ModelComponentTypes.ListBox, `Unexpected ModelComponentType. Expected ListBox but got ${ModelComponentTypes[itemConfigs[1].toIItemConfig().componentShape.type]}`);
assert.strictEqual(itemConfigs.length, 2, `Unexpected number of items in list. Expected 2, got ${itemConfigs.length} ${JSON.stringify(itemConfigs)}`);
assert.strictEqual(itemConfigs[1].toIItemConfig().componentShape.type, ModelComponentTypes.ListBox, `Unexpected ModelComponentType. Expected ListBox but got ${ModelComponentTypes[itemConfigs[1].toIItemConfig().componentShape.type]}`);
});
});

View File

@@ -43,24 +43,24 @@ suite('ExtHostModelViewDialog Tests', () => {
let title = 'dialog_title';
let dialog = extHostModelViewDialog.createDialog(title);
assert.equal(dialog.title, title);
assert.equal(dialog.okButton.enabled, true);
assert.equal(dialog.cancelButton.enabled, true);
assert.strictEqual(dialog.title, title);
assert.strictEqual(dialog.okButton.enabled, true);
assert.strictEqual(dialog.cancelButton.enabled, true);
});
test('Creating a tab returns a tab with the given title', () => {
let title = 'tab_title';
let tab = extHostModelViewDialog.createTab(title);
assert.equal(tab.title, title);
assert.strictEqual(tab.title, title);
});
test('Creating a button returns an enabled button with the given label', () => {
let label = 'button_label';
let button = extHostModelViewDialog.createButton(label);
assert.equal(button.label, label);
assert.equal(button.enabled, true);
assert.strictEqual(button.label, label);
assert.strictEqual(button.enabled, true);
});
test('Opening a dialog updates its tabs and buttons on the main thread', () => {
@@ -125,19 +125,19 @@ suite('ExtHostModelViewDialog Tests', () => {
extHostModelViewDialog.$onButtonClick(button1Handle);
// Then the clicks should have been handled by the expected handlers
assert.deepEqual(clickEvents, [1, 2, 2, 1]);
assert.deepStrictEqual(clickEvents, [1, 2, 2, 1]);
});
test('Creating a wizard returns a wizard with initialized buttons and the given title', () => {
let title = 'wizard_title';
let wizard = extHostModelViewDialog.createWizard(title);
assert.equal(wizard.title, title);
assert.equal(wizard.doneButton.enabled, true);
assert.equal(wizard.cancelButton.enabled, true);
assert.equal(wizard.nextButton.enabled, true);
assert.equal(wizard.backButton.enabled, true);
assert.deepEqual(wizard.pages, []);
assert.strictEqual(wizard.title, title);
assert.strictEqual(wizard.doneButton.enabled, true);
assert.strictEqual(wizard.cancelButton.enabled, true);
assert.strictEqual(wizard.nextButton.enabled, true);
assert.strictEqual(wizard.backButton.enabled, true);
assert.deepStrictEqual(wizard.pages, []);
});
test('Opening a wizard updates its pages and buttons on the main thread', () => {
@@ -207,9 +207,9 @@ suite('ExtHostModelViewDialog Tests', () => {
newPage: 1
};
extHostModelViewDialog.$onWizardPageChanged(wizardHandle, expectedPageChangeInfo);
assert.equal(actualPageChangeInfo.length, 1);
assert.equal(actualPageChangeInfo[0], expectedPageChangeInfo);
assert.equal(wizard.currentPage, expectedPageChangeInfo.newPage);
assert.strictEqual(actualPageChangeInfo.length, 1);
assert.strictEqual(actualPageChangeInfo[0], expectedPageChangeInfo);
assert.strictEqual(wizard.currentPage, expectedPageChangeInfo.newPage);
});
test('Validity changed events are handled correctly', () => {
@@ -232,11 +232,11 @@ suite('ExtHostModelViewDialog Tests', () => {
// Call the validity changed event on tab 2 and verify that it was handled but tab 1 is still not valid
extHostModelViewDialog.$onPanelValidityChanged(tabHandles[1], false);
assert.equal(tab1ValidityChangedEvents.length, 0);
assert.equal(tab1.valid, true);
assert.equal(tab2ValidityChangedEvents.length, 1);
assert.equal(tab2ValidityChangedEvents[0], false);
assert.equal(tab2.valid, false);
assert.strictEqual(tab1ValidityChangedEvents.length, 0);
assert.strictEqual(tab1.valid, true);
assert.strictEqual(tab2ValidityChangedEvents.length, 1);
assert.strictEqual(tab2ValidityChangedEvents[0], false);
assert.strictEqual(tab2.valid, false);
});
test('Verify validity changed events update validity for all panel types', () => {
@@ -258,11 +258,11 @@ suite('ExtHostModelViewDialog Tests', () => {
// Call the validity changed event on each object and verify that the object's validity was updated
extHostModelViewDialog.$onPanelValidityChanged(tabHandle, false);
assert.equal(tab.valid, false);
assert.strictEqual(tab.valid, false);
extHostModelViewDialog.$onPanelValidityChanged(dialogHandle, false);
assert.equal(dialog.valid, false);
assert.strictEqual(dialog.valid, false);
extHostModelViewDialog.$onPanelValidityChanged(pageHandle, false);
assert.equal(page.valid, false);
assert.strictEqual(page.valid, false);
});
test('Main thread can execute wizard navigation validation', () => {
@@ -286,9 +286,9 @@ suite('ExtHostModelViewDialog Tests', () => {
lastPage: lastPage,
newPage: newPage
});
assert.notEqual(validationInfo, undefined);
assert.equal(validationInfo.lastPage, lastPage);
assert.equal(validationInfo.newPage, newPage);
assert.notStrictEqual(validationInfo, undefined);
assert.strictEqual(validationInfo.lastPage, lastPage);
assert.strictEqual(validationInfo.newPage, newPage);
});
test('Changing the wizard message sends the new message to the main thread', () => {
@@ -323,6 +323,6 @@ suite('ExtHostModelViewDialog Tests', () => {
// If I call the validation from the main thread then it should run
extHostModelViewDialog.$validateDialogClose(dialogHandle);
assert.equal(callCount, 1);
assert.strictEqual(callCount, 1);
});
});

View File

@@ -84,27 +84,27 @@ suite('ExtHostObjectExplorer Tests', () => {
suite('getParent', () => {
test('Should return undefined if no parent', async () => {
extHostObjectExplorerNode = new ExtHostObjectExplorerNode(nodes['Server1'], 'connectionId', mockProxy.object);
assert.equal(await extHostObjectExplorerNode.getParent(), undefined);
assert.strictEqual(await extHostObjectExplorerNode.getParent(), undefined);
});
test('should return root with direct descendent of root', async () => {
extHostObjectExplorerNode = new ExtHostObjectExplorerNode(nodes['DatabasesFolder'], 'connectionId', mockProxy.object);
assert.equal((await extHostObjectExplorerNode.getParent()).nodePath, nodes['Server1'].nodePath);
assert.strictEqual((await extHostObjectExplorerNode.getParent()).nodePath, nodes['Server1'].nodePath);
});
test('should return correct parent with further descendent of root', async () => {
extHostObjectExplorerNode = new ExtHostObjectExplorerNode(nodes['Database1'], 'connectionId', mockProxy.object);
assert.equal((await extHostObjectExplorerNode.getParent()).nodePath, nodes['DatabasesFolder'].nodePath);
assert.strictEqual((await extHostObjectExplorerNode.getParent()).nodePath, nodes['DatabasesFolder'].nodePath);
});
test('should return correct parent with node having / in its name', async () => {
extHostObjectExplorerNode = new ExtHostObjectExplorerNode(nodes['Database2'], 'connectionId', mockProxy.object);
assert.equal((await extHostObjectExplorerNode.getParent()).nodePath, nodes['DatabasesFolder'].nodePath);
assert.strictEqual((await extHostObjectExplorerNode.getParent()).nodePath, nodes['DatabasesFolder'].nodePath);
});
test('should return correct parent with parent node having / in its name', async () => {
extHostObjectExplorerNode = new ExtHostObjectExplorerNode(nodes['TablesFolder'], 'connectionId', mockProxy.object);
assert.equal((await extHostObjectExplorerNode.getParent()).nodePath, nodes['Database2'].nodePath);
assert.strictEqual((await extHostObjectExplorerNode.getParent()).nodePath, nodes['Database2'].nodePath);
});
});
});

View File

@@ -86,8 +86,8 @@ suite('ExtHostNotebook Tests', () => {
// Then I expect the 2 different handles in the managers returned.
// This is because we can't easily track identity of the managers, so just track which one is assigned to
// a notebook by the handle ID
assert.notEqual(originalManagerDetails.handle, differentDetails.handle, 'Should have unique handle for each manager');
assert.equal(originalManagerDetails.handle, sameDetails.handle, 'Should have same handle when same URI is passed in');
assert.notStrictEqual(originalManagerDetails.handle, differentDetails.handle, 'Should have unique handle for each manager');
assert.strictEqual(originalManagerDetails.handle, sameDetails.handle, 'Should have same handle when same URI is passed in');
});
});

View File

@@ -196,22 +196,22 @@ suite('MainThreadModelViewDialog Tests', () => {
// Then the opened dialog's content and buttons match what was set
mockDialogService.verify(x => x.showDialog(It.isAny(), undefined, It.isAny()), Times.once());
assert.notEqual(openedDialog, undefined);
assert.equal(openedDialog.title, dialogDetails.title);
assert.equal(openedDialog.okButton.label, okButtonDetails.label);
assert.equal(openedDialog.okButton.enabled, okButtonDetails.enabled);
assert.equal(openedDialog.cancelButton.label, cancelButtonDetails.label);
assert.equal(openedDialog.cancelButton.enabled, cancelButtonDetails.enabled);
assert.equal(openedDialog.customButtons.length, 2);
assert.equal(openedDialog.customButtons[0].label, button1Details.label);
assert.equal(openedDialog.customButtons[0].enabled, button1Details.enabled);
assert.equal(openedDialog.customButtons[1].label, button2Details.label);
assert.equal(openedDialog.customButtons[1].enabled, button2Details.enabled);
assert.equal(openedDialog.content.length, 2);
assert.equal((openedDialog.content[0] as DialogTab).content, tab1Details.content);
assert.equal((openedDialog.content[0] as DialogTab).title, tab1Details.title);
assert.equal((openedDialog.content[1] as DialogTab).content, tab2Details.content);
assert.equal((openedDialog.content[1] as DialogTab).title, tab2Details.title);
assert.notStrictEqual(openedDialog, undefined);
assert.strictEqual(openedDialog.title, dialogDetails.title);
assert.strictEqual(openedDialog.okButton.label, okButtonDetails.label);
assert.strictEqual(openedDialog.okButton.enabled, okButtonDetails.enabled);
assert.strictEqual(openedDialog.cancelButton.label, cancelButtonDetails.label);
assert.strictEqual(openedDialog.cancelButton.enabled, cancelButtonDetails.enabled);
assert.strictEqual(openedDialog.customButtons.length, 2);
assert.strictEqual(openedDialog.customButtons[0].label, button1Details.label);
assert.strictEqual(openedDialog.customButtons[0].enabled, button1Details.enabled);
assert.strictEqual(openedDialog.customButtons[1].label, button2Details.label);
assert.strictEqual(openedDialog.customButtons[1].enabled, button2Details.enabled);
assert.strictEqual(openedDialog.content.length, 2);
assert.strictEqual((openedDialog.content[0] as DialogTab).content, tab1Details.content);
assert.strictEqual((openedDialog.content[0] as DialogTab).title, tab1Details.title);
assert.strictEqual((openedDialog.content[1] as DialogTab).content, tab2Details.content);
assert.strictEqual((openedDialog.content[1] as DialogTab).title, tab2Details.title);
});
test('Button presses are forwarded to the extension host', () => {
@@ -243,7 +243,7 @@ suite('MainThreadModelViewDialog Tests', () => {
okEmitter.fire();
// Verify that the correct button click notifications were sent to the proxy
assert.deepEqual(pressedHandles, [button1Handle, button2Handle, okButtonHandle, cancelButtonHandle, button2Handle, cancelButtonHandle, button1Handle, okButtonHandle]);
assert.deepStrictEqual(pressedHandles, [button1Handle, button2Handle, okButtonHandle, cancelButtonHandle, button2Handle, cancelButtonHandle, button1Handle, okButtonHandle]);
});
test('Creating a wizard and calling open on it causes a wizard with correct pages and buttons to open', () => {
@@ -252,30 +252,30 @@ suite('MainThreadModelViewDialog Tests', () => {
// Then the opened wizard's content and buttons match what was set
mockDialogService.verify(x => x.showWizard(It.isAny(), It.isAny(), It.isAny()), Times.once());
assert.notEqual(openedWizard, undefined);
assert.equal(openedWizard.title, wizardDetails.title);
assert.equal(openedWizard.doneButton.label, okButtonDetails.label);
assert.equal(openedWizard.doneButton.enabled, okButtonDetails.enabled);
assert.equal(openedWizard.cancelButton.label, cancelButtonDetails.label);
assert.equal(openedWizard.cancelButton.enabled, cancelButtonDetails.enabled);
assert.equal(openedWizard.customButtons.length, 0);
assert.equal(openedWizard.pages.length, 2);
assert.equal(openedWizard.currentPage, 0);
assert.equal(openedWizard.displayPageTitles, wizardDetails.displayPageTitles);
assert.notStrictEqual(openedWizard, undefined);
assert.strictEqual(openedWizard.title, wizardDetails.title);
assert.strictEqual(openedWizard.doneButton.label, okButtonDetails.label);
assert.strictEqual(openedWizard.doneButton.enabled, okButtonDetails.enabled);
assert.strictEqual(openedWizard.cancelButton.label, cancelButtonDetails.label);
assert.strictEqual(openedWizard.cancelButton.enabled, cancelButtonDetails.enabled);
assert.strictEqual(openedWizard.customButtons.length, 0);
assert.strictEqual(openedWizard.pages.length, 2);
assert.strictEqual(openedWizard.currentPage, 0);
assert.strictEqual(openedWizard.displayPageTitles, wizardDetails.displayPageTitles);
let page1 = openedWizard.pages[0];
assert.equal(page1.title, page1Details.title);
assert.equal(page1.content, page1Details.content);
assert.equal(page1.enabled, page1Details.enabled);
assert.equal(page1.valid, true);
assert.equal(page1.customButtons.length, 0);
assert.equal(page1.description, page1Details.description);
assert.strictEqual(page1.title, page1Details.title);
assert.strictEqual(page1.content, page1Details.content);
assert.strictEqual(page1.enabled, page1Details.enabled);
assert.strictEqual(page1.valid, true);
assert.strictEqual(page1.customButtons.length, 0);
assert.strictEqual(page1.description, page1Details.description);
let page2 = openedWizard.pages[1];
assert.equal(page2.title, page2Details.title);
assert.equal(page2.content, page2Details.content);
assert.equal(page2.enabled, page2Details.enabled);
assert.equal(page2.valid, true);
assert.equal(page2.customButtons.length, 2);
assert.equal(page2.description, page2Details.description);
assert.strictEqual(page2.title, page2Details.title);
assert.strictEqual(page2.content, page2Details.content);
assert.strictEqual(page2.enabled, page2Details.enabled);
assert.strictEqual(page2.valid, true);
assert.strictEqual(page2.customButtons.length, 2);
assert.strictEqual(page2.description, page2Details.description);
});
test('The extension host gets notified when wizard page change events occur', () => {
@@ -364,8 +364,8 @@ suite('MainThreadModelViewDialog Tests', () => {
mainThreadModelViewDialog.$setWizardDetails(wizardHandle, wizardDetails);
// Then the message gets changed on the wizard
assert.equal(newMessage, wizardDetails.message, 'New message was not included in the fired event');
assert.equal(openedWizard.message, wizardDetails.message, 'New message was not set on the wizard');
assert.strictEqual(newMessage, wizardDetails.message, 'New message was not included in the fired event');
assert.strictEqual(openedWizard.message, wizardDetails.message, 'New message was not set on the wizard');
});
test('Creating a dialog adds a close validation that calls the extension host', () => {

View File

@@ -70,7 +70,7 @@ suite('MainThreadNotebook Tests', () => {
mainThreadNotebook.$registerNotebookProvider(providerId, 1);
// Then I expect a provider implementation to be passed to the service
mockNotebookService.verify(s => s.registerProvider(TypeMoq.It.isAnyString(), TypeMoq.It.isAny()), TypeMoq.Times.once());
assert.equal(provider.providerId, providerId);
assert.strictEqual(provider.providerId, providerId);
});
test('should unregister in service', () => {
// Given we have a provider
@@ -118,7 +118,7 @@ suite('MainThreadNotebook Tests', () => {
// Then it should use the built-in content manager
assert.ok(manager.contentManager instanceof LocalContentManager);
// And it should not define a server manager
assert.equal(manager.serverManager, undefined);
assert.strictEqual(manager.serverManager, undefined);
});
test('should return manager with a content & server manager if extension host has these', async () => {
@@ -131,7 +131,7 @@ suite('MainThreadNotebook Tests', () => {
// Then it shouldn't have wrappers for the content or server manager
assert.ok(!(manager.contentManager instanceof LocalContentManager));
assert.notEqual(manager.serverManager, undefined);
assert.notStrictEqual(manager.serverManager, undefined);
});
});

View File

@@ -67,7 +67,7 @@ suite('ComponentBase Tests', () => {
});
test('Component validation runs external validations stored in the model store', () => {
assert.equal(testComponent.valid, true, 'Test component validity did not default to true');
assert.strictEqual(testComponent.valid, true, 'Test component validity did not default to true');
let validationCalls = 0;
modelStore.registerValidationCallback(componentId => {
validationCalls += 1;
@@ -75,14 +75,14 @@ suite('ComponentBase Tests', () => {
});
return testComponent.validate().then(valid => {
assert.equal(validationCalls, 1, 'External validation was not called once');
assert.equal(valid, false, 'Validate call did not return correct value from the external validation');
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
assert.strictEqual(validationCalls, 1, 'External validation was not called once');
assert.strictEqual(valid, false, 'Validate call did not return correct value from the external validation');
assert.strictEqual(testComponent.valid, false, 'Validate call did not update the component valid property');
});
});
test('Component validation runs default component validations', () => {
assert.equal(testComponent.valid, true, 'Test component validity did not default to true');
assert.strictEqual(testComponent.valid, true, 'Test component validity did not default to true');
let validationCalls = 0;
testComponent.addValidation(() => {
validationCalls += 1;
@@ -90,20 +90,20 @@ suite('ComponentBase Tests', () => {
});
return testComponent.validate().then(valid => {
assert.equal(validationCalls, 1, 'Default validation was not called once');
assert.equal(valid, false, 'Validate call did not return correct value from the default validation');
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
assert.strictEqual(validationCalls, 1, 'Default validation was not called once');
assert.strictEqual(valid, false, 'Validate call did not return correct value from the default validation');
assert.strictEqual(testComponent.valid, false, 'Validate call did not update the component valid property');
});
});
test('Container validation reflects child component validity', () => {
assert.equal(testContainer.valid, true, 'Test container validity did not default to true');
assert.strictEqual(testContainer.valid, true, 'Test container validity did not default to true');
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
testComponent.addValidation(() => false);
return testComponent.validate().then(() => {
return testContainer.validate().then(valid => {
assert.equal(valid, false, 'Validate call did not return correct value for container child validation');
assert.equal(testContainer.valid, false, 'Validate call did not update the container valid property');
assert.strictEqual(valid, false, 'Validate call did not return correct value for container child validation');
assert.strictEqual(testContainer.valid, false, 'Validate call did not update the container valid property');
});
});
});
@@ -112,8 +112,8 @@ suite('ComponentBase Tests', () => {
testContainer.registerEventHandler(event => {
try {
if (event.eventType === ComponentEventType.validityChanged) {
assert.equal(testContainer.valid, false, 'Test container validity did not change to false when child validity changed');
assert.equal(event.args, false, 'ValidityChanged event did not contain the updated container validity');
assert.strictEqual(testContainer.valid, false, 'Test container validity did not change to false when child validity changed');
assert.strictEqual(event.args, false, 'ValidityChanged event did not contain the updated container validity');
done();
}
} catch (err) {
@@ -127,51 +127,51 @@ suite('ComponentBase Tests', () => {
test('Inserting a component to a container adds the component to the right place', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
testContainer.addToContainer([{ componentDescriptor: testComponent2.descriptor, config: undefined, index: 0 }]);
assert.equal(testContainer.TestItems.length, 2, `Unexpected number of items. Expected 2 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.equal(testContainer.TestItems[0].descriptor.id, testComponent2.descriptor.id);
assert.strictEqual(testContainer.TestItems.length, 2, `Unexpected number of items. Expected 2 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems[0].descriptor.id, testComponent2.descriptor.id);
});
test('Inserting a component to a container given negative index fails', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.throws(() => testContainer.addToContainer([{ componentDescriptor: testComponent2.descriptor, config: undefined, index: -1 }]));
});
test('Inserting a component to a container given wrong index fails', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.throws(() => testContainer.addToContainer([{ componentDescriptor: testComponent2.descriptor, config: undefined, index: 10 }]));
});
test('Inserting a component to a container given end of list succeeds', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
testContainer.addToContainer([{ componentDescriptor: testComponent2.descriptor, config: undefined, index: 1 }]);
assert.equal(testContainer.TestItems.length, 2, `Unexpected number of items. Expected 2 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 2, `Unexpected number of items. Expected 2 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
});
test('Removing a component the does not exist does not make change in the items', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
testContainer.removeFromContainer(testComponent2.descriptor);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
});
test('Removing a component removes it from items', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
testContainer.addToContainer([{ componentDescriptor: testComponent2.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 2, `Unexpected number of items. Expected 2 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 2, `Unexpected number of items. Expected 2 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
testContainer.removeFromContainer(testComponent.descriptor);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.equal(testContainer.TestItems[0].descriptor.id, testComponent2.descriptor.id);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems[0].descriptor.id, testComponent2.descriptor.id);
});
test('Container dost not add same component twice', () => {
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
testContainer.addToContainer([{ componentDescriptor: testComponent.descriptor, config: undefined, index: 0 }]);
assert.equal(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
assert.strictEqual(testContainer.TestItems.length, 1, `Unexpected number of items. Expected 1 got ${testContainer.TestItems.length} : ${JSON.stringify(testContainer.TestItems)}`);
});
});

View File

@@ -34,7 +34,7 @@ suite('TableComponent Tests', () => {
'c3': '6'
}
];
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('Table transformData should return empty array given undefined rows', () => {
@@ -43,7 +43,7 @@ suite('TableComponent Tests', () => {
let columns = ['c1', 'c2', 'c3'];
let actual = tableComponent.transformData(data, columns);
let expected: { [key: string]: string }[] = [];
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('Table transformData should return empty array given undefined columns', () => {
@@ -55,7 +55,7 @@ suite('TableComponent Tests', () => {
const tableComponent = new TableComponent(undefined, undefined, undefined, new NullLogService(), undefined);
let actual = tableComponent.transformData(data, columns);
let expected: { [key: string]: string }[] = [];
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
test('Table transformData should return array matched with columns given rows with missing column', () => {
@@ -76,6 +76,6 @@ suite('TableComponent Tests', () => {
'c2': '5'
}
];
assert.deepEqual(actual, expected);
assert.deepStrictEqual(actual, expected);
});
});